Answer the question
In order to leave comments, you need to log in
$.getJSON doesn't work but $.get does?
Help solve the problem.
doing so
$.getJSON('http://somedomain.com/mmm?callback=? ')
.done(function(data) {
console.log(data);
})
.fail(function(jqXHR, status, error) {
console.log(status, error);
});
parsererror SyntaxError {stack: (...), message: "Unexpected token :"}
HTTP/1.1 200 OK
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Sat, 12 Apr 2014 13:56:33 GMT
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Pragma: no-cache
Server: nginx/1.4.5
Transfer-Encoding: chunked
X-Powered-By: PHP/5.6.0alpha1
echo $this->json($this->result, array(
'enableJsonExprFinder' => true,
));
Answer the question
In order to leave comments, you need to log in
You need to understand the difference between jsonp and json. These are fundamentally different things. Jsonp is how your script will wrap and play. It needs a callback. With jsonp, a script dom element is created in the body of the document into which the response is inserted. Naturally, this element must contain valid js code, with a function. Those. the server should return something like function qwe(){ /* code here */ }. And json is, in fact, a serialized array in some way, which by itself will not be executed in any way.
And look what comes to jqXHR.responseText.
Maybe there's some bullshit in there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question