I'm having troubles with ajax. my code runs well, but then, it always goes to success.
dataLogin = 'mail=' + $('#login_mail').val() + '&pass=' + $('#login_password').val() + '&on=' + manter_ligado;
$.ajax({ url: 'modules/login.php?' + dataLogin,
type: 'POST',
//data: dataLogin,
data : {
mail : $('#login_mail').val(),
pass : $('#login_password').val(),
on : manter_ligado
},
success: function(data) {
alert(data);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert("Status: " + textStatus); alert("Error: " + errorThrown);
}
});
can anyone help me with this? Also, I'm using sublime to code, and it gives me some errors on the ajax, but I can't seem to correct them, it might help knowing this
Also, I know that the php works, because I can make the login on the website, but the problem I have is when the user/pass is incorrect
Make sure the server is returning an error code of 500.
In the php.ini file, make sure displayErrors is set to Off
To get the ajax to hit the failure function, you may need to throw an error when one occurs in your PHP