Hi, I have a problem with the method app.request. If the response of the server is something as 401, 404 and so on, the StatusCode is not executed and the app executes the same the success. where is the mistake?
Thank you in advance
app.request({
url: url,
method: 'POST',
dataType: 'json',
statusCode: {
401: function (xhr) {
app.preloader.hide();
app.dialog.alert('[400] Spiacenti, si è verificato un errore');
},
404: function (xhr) {
app.preloader.hide();
app.dialog.alert('[400] Spiacenti, si è verificato un errore');
},
500: function (xhr) {
app.preloader.hide();
app.dialog.alert('[400] Spiacenti, si è verificato un errore');
}
},//status code
method: 'POST',
data: {keys:k,identity:storedData.username, password:storedData.password},
success: function (data) {
console.log('success');
},//success
error: function(){
console.log('error');
}//error
});//request