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?