I am making a cross domain JSONP call using this code:
jQuery.ajax({
async: true,
url: 'http://mnews.hostoi.com/test.json',
dataType: 'jsonp',
method: "GET",
error: function (jqXHR, textStatus, errorThrown) {
console.log(textStatus + ': ' + errorThrown);
},
success: function (data, textStatus, jqXHR) {
if (data.Error || data.Response) {
exists = 0;
}
}
});
When debugging in Firebug, I get the following error:
SyntaxError: missing ; before statement
However, when I pass my json object (available through the link in the JQ code) through a tool like jsonlint.com, it says it is valid JSON. And I don't find any anomalies either. How could it be returning a syntax error? Is it some JSONP detail I am not getting or what?
JSON Sample
{"news":[ {
"sentences": [
"Neuroscientists have discovered abnormal neural activity...",
"The researchers found that these mice showed many symptoms...",
""Therefore," the study authors say, "our findings provide a novel.."
],
"summaryId": "ZJEmY5",
"title": "Abnormal neural activity linked to schizophrenia"
}]}
Thanks in advance.
question from:
https://stackoverflow.com/questions/19456146/ajax-call-and-clean-json-but-syntax-error-missing-before-statement 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…