Reputation: 115
I have an AJAX request like:
Ext.Ajax.request({
url: 'login.php',
scope: me,
params: {
email: '[email protected]',
password: '12345',
},
success: function(){console.log('OK');},
failure: function(){console.log('ERROR');},
});
The console.log is 'OK', even though the response is false
Upvotes: 0
Views: 597
Reputation: 15
The success callback function has two return arguments, the first is the response from the server. Decoding the response will allow you to check for a successful login, something like this:
success: function(response, opts) {
var obj = Ext.decode(response.responseText);
if (obj.success === true) console.log('success!');
}
Upvotes: 1
Reputation: 3076
The failure callback fires only if an HTTP status returned from the server is different than 200 OK.
Change the status in response or check the value of success
parameter just in success
callback.
Upvotes: 2