ajax - How to get response from cross domain using jsonp -



ajax - How to get response from cross domain using jsonp -

i working on ajax login on cross domain , request has been sent correctly , getting response other domain onsuccess function not getting called. have tried writing onsuccess within request like

sucess : function(){}

but not getting called.

my code snippet :

new ajax.jsonrequest(this.precheckurl, { callbackparamname: "jsoncallback", parameters: { useremail: this.useremail, userpassword: this.userpassword, format: 'json' }, onsuccess:function(response) { alert('hello'); } });

-thanx.

your request looks good, according documentation. readme.md

handling failures

since there no way inspect happens after create request jsonp technique, we're stuck having create informed guesses what's going on.

this illustration makes request invalid url. since callback not invoked within default timeout period (10 seconds) request "cancelled" , onfailure callback invoked if specified. ajax.jsonresponse have status of 504 , statustext of "gateway timeout".

new ajax.jsonrequest('http://api.flickr.com/services/feeds/asdfasdfasdfasdfasdfsdf', { callbackparamname: "jsoncallback", parameters: { tags: 'cat', tagmode: 'any', format: 'json' }, oncreate: function(response) { console.log("2: create", response, response.responsejson); }, onsuccess: function(response) { console.log("2: success", response, response.responsejson); }, onfailure: function(response) { console.log("2: fail", response, response.responsejson); }, oncomplete: function(response) { console.log("2: complete", response, response.responsejson); } });

so, should add together additional callbacks, see what's going wrong.

ajax json cross-domain jsonp

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -