For small amounts of textual info ( Control Messages ) I send what I call bullets (Same syntax as HTML comments ) along with my page during ajax calls. For example
<!--Control Message--><html> all my page here</html>
I then parse the "Bullet" out before rendering the page...even though I don't really have to.
For more data, say 5 variables, I plan on json_encoding it...and sending it with the page as well.
How are others demarcating and extracting the structured data / json strings from html. I could just put it in a "bullet" like below and extract it out...but my guess is there is a more "proper" way to do this.
<!--json string here--><html> all my page here</html>