2

So I am creating a website using Craft with JavaScript for making it a single page app. I load my layout which then calls the pages which works well.

The only problem is that when viewing pages through Live Preview I can't load the content. The layout gets loaded but not the content that the JavaScript adds calling for the pages. At first I thought it might be a problem with JavaScript in the iframe, but I don't think this is the issue.

I think the calls to my JavaScript is getting the saved data from the DB and not the data from the Live Preview.

How can I make Live Preview work with my single page app? Would somebody be able to explain how Live Preview works? Can I watch for the update event so that I can update the page with the Live Preview data?

  • Did anyone find a solution for this already? I’m having the same issue using Craft with a JavaScript frontend and loading data via Element API Plugins JSON endpoints. – periodical Nov 20 '17 at 9:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.