I am trying to get out a JSON object, but I end up with getting all the HTML as well.
alert("5 " + request.responseText);
var JSONObject = eval( + "(" + request.responseText + ")" );
alert("text1: " + JSONObject.name);
So, the first line prints pure html code in an alert. Is it supposed to do that, or is the responseText supposed to only be the JSON Object?
The second line does not work, so the third line doesn’t print.
I’ve seen examples where they just use eval on the responseText as I do, but in my case it doesn’t work… Any suggestions?
Sounds like the server side’s spewing HTML and JSON in one response. I’d start by checking the call in a browser or a proxy like fiddler to make sure it’s only JSON coming back.