I Have built a system that uses a simple templating system to separate the logic from layout, but after I have populated my templates with data on the server I want to send this to javascript on the client so that I can dynamically add the templates and content to the page.
I am having some issues handling HTML in javascript. I tried serializing in PHP and then unserializing in javascript with no luck. If I use json_encode() PHP function this gives me errors. My PHP return is just a simple arraywith HTML as one element.
I have also been looking at JavaScript templating systems as I like the idea of using the server just to process data leaving the client to process layout and templates. But is there a way to copy HTML in JavaScript.
Any help or advice appreciated.