but long HTML will show an error. Example will work. "messages":[ " <div id="header_inner1"> ... </div>
" ],
Fotiman
1:43 pm on Mar 20, 2015 (gmt 0)
You've got a double quoted string within your double quoted string. So you need to either use single quotes for one of them, or escape the double quotes within the string: "messages":[ " <div id='header_inner1'> ... </div>
I have tested. It will not work your suggestion. I'm not sure. "messages":[ "<div class='myID1' id='mybanner' style='top: 0px;'> <div id='header_inner1'>
</div> </div>" ],
Fotiman
2:28 pm on Mar 20, 2015 (gmt 0)
Is your JavaScript in an external .js file (it should be) or is it inline in your HTML like this: <script> "messages":[ .... </script>
If it's inline, then you also need to escape the slashes, or the browser may think that </div> is closing an element. You don't need to worry about that if the file is external and included like this: <script src="..."></script>
toplisek
3:57 pm on Mar 20, 2015 (gmt 0)
I have done external file as testing. "messages":[ {/literal}{include file="myfile.tpl"}{literal} ],
It seems still an error.
toplisek
4:01 pm on Mar 20, 2015 (gmt 0)
I have an error: Error: SyntaxError: expected expression, got '<' <div class="home" id="mybanner" style="top: 0px;">
Fotiman
5:42 pm on Mar 20, 2015 (gmt 0)
I have done external file as testing. "messages":[ {/literal}{include file="myfile.tpl"}{literal} ],
It seems still an error.
Now you're missing quotes around the entire value. Should be something like this: