json -> the response returned back
{"msg":"<DIV><P>Unfortunately we were unable to process your application.</p><BR>Please upload a CV<BR></DIV>", "status":"error"}
The error
SCRIPT1015: Unterminated string constant
The line with the error
var data = $(this).contents().find('body').html();//I have console logged this and holds the above json as a string.
data = jQuery.parseJSON(data);// problem is here.
for some reason I think, it may be because the html tags because .text() works as oppose to .html(), however I need to use the .html() because it’s formatted there with html tags.
Any suggestions ?
Is that a line break in the json? If that’s the case, then that’s your error. Try eliminating it with something like
data.replace( '\n', ' ' ).Update from the comments: Val realized that the IE8 parser was in fact borking on his test case, while the original javascript JSON parser handled it just fine. If you need that original parser, it’s at: https://github.com/douglascrockford/JSON-js as linked to from: http://www.json.org and is pretty much a drop in replacement.