I am using jquery ajax request which gets the HTML content from backend code. If status is OK, I am appending HTML content to a div. I am using following code to append div using jquery ajax. as $('#divElm').html(response.data);
. But after appending I am getting following error:
SyntaxError: missing } in compound statement
The HTML content rendering from backend (ie., response.data) contains the following which is causing this error:
<script type="text/javascript">
function init() {
if(d.getElementById('normal')){
window.normalPop= d.getElementById('normal');
//complicated is local
var complicated= normalPop.parentNode.removeChild(normal);
d.getElementsByTagName('body')[0].appendChild(complicated);
}
}
addLoadEvent(init);
</script>
I am not sure why this error "SyntaxError: missing } in compound statement" is coming.The } braces are closing properly in the code.
If I am using innerHTML
instead of html()
it is working fine. No error is rendering.