jQuery ajax cross-domain request -
i trying create ajax request using jquery local environment.
$.ajax({ url: requesturl, datatype: "json", timeout: 120000, success: function(data){ // }, error: function(xmlhttprequest, textstatus, errorthrown){ console.log("instants.loadgame: error loading games: error text: " + textstatus + "; error thrown: " + errorthrown); } });
i have tried using datatype json , jsonp (as else seems fixes problem) errors either way. datatype json error response has textstatus = "error" , errorthrown empty. datatype jsonp error response has textstatus = "parsererror" , errorthrown = "jquery19002007321439859855_1361446807440 not called".
i know code works when running on same domain request url can assume because doing on local environment. have set cross-domain.xml allow everything. using jquery 1.9.0.
does have ideas? have been looking @ lot online none of solutions helped other people seem work me...
thanks, heather
when error "jquery19002007321439859855_1361446807440 not called" it's because it's not right jsonp response. when using jsonp server need javascript (an actual script) , script needs phone call function provided part of url (in case funciton named jquery19002007321439859855_1361446807440 jquery maps success handler provided.
most cause server returned plain json info won't work. info need passed script. request server should homecoming like
var info = {"foo":1}; //your info here jquery19002007321439859855_1361446807440(data);
jquery ajax json cross-domain jsonp
No comments:
Post a Comment