I’m having this issue and I can’t seem to get my way.
I use:
$('#DIV').html("<%=DIVContent%>");
The function DIVContent (.NET C sharp code) basically returns the contents of (a) page(s) dynamically. AJAX is not an option (cross domain) so it has to be fetched server-side. The server-side function also does the necessary stripping (replacing ” with ‘ etc). This all works fine, the html gets into the div correctly.
Now I’m having a page with some jQuery code in it. This causes my .html(…) to break.
I’ve tried a lot of things, like htmlEncoding etc to make this work but no avail.
Can anyone tell me which steps I need to take?
Edit: also, the javascript error I get is: ulterminated string literal $(‘#DIV’).html(“……..”)
Edit II: Orbiting Eden did some nice out of the box thinking and it’s solved now. Instead of filling the DIV with jQuery using .html() I now directly insert the contents using <%DIVContent%>. Credits to him for thinking differently 🙂 By the way, if anyone knows why .html() fails when JavaScript/jQuery code is inserted and how to tackle it.. Please do respond 🙂 Thanks a lot!
Thanks in advance!
Try:
This is the most direct solution for you. After much thought, I can’t see where you need javascript involved at all