I'm trying to download JSONP from other server but I still getting error (in FF inspector SyntaxError: missing ; before statement
).
To connect with server I'm using simple $.getJSON:
$.getJSON(url + "?callback=?", function(data) {
$("#main").html(data);
});
On the server I have this JSON:
{"branchName":"war140820rc1","commitId":"fcf600371bc9e837290799e0d7f7e848ccf12e7d"}
What is my problem? I checked this code multiple times and it looks like other JSONP downloaders.
Keep in mind that the request will look something like this:
<script src="http://yourdomain.com/?callback=callback"></script>
Which means it is handled as a Javascript file. Therefor you the callback passed in ?callback=
should be called like every other javascript function, and you pass the result in json. Like:
callback(<?= MYJSON ?>);