PDA

View Full Version : JSONP Catch 400 Bad Request



Kurt001
29 Jul 2011, 6:23 PM
Hi,

I need to catch a 400 Bad Request, because the company I am working for does not get the server to respond in a proper way.
If the wrong login information are send, the server simply responds in time with a 400 Bad Request.

How can I catch this?

Here is my code so far:


Ext.util.JSONP.request({
/**
* this is the JSONP Function
* @callbackKey param sets the callback function (callback --> Ext.util.JSONP.callback)
* @jsonpcallback param this needs NOT to be set once the callback function is in place
*/
url: 'http://staging.havabet.com/api/users/login',
//callbackKey: 'jsonpcallback',
params: { username: nameField, password: passwordField, jsonpcallback: 'callback'},
callback: function(result){},//needs to be set once the callback function is in place
timeout: 5000,
//does not catch the 400 Bad Request
listeners: {exception:function () {console.log("offline");}}
});//Ext.util.JSONP.request END


Any idea how I can catch that error?

Best Kurt