I am trying to send an AJAX request to login. Yesterday it was working perfectly but today when I send a request it sends one request perfectly but a second is unwanted. I'm stuck how to deal with this. Please help.
$('#login_form').submit(function(e) {
e.preventDefault();
$.post("<?php echo base_url() ?>login/login_user",
$(this).serializeArray(),
function(data) {
if (data == 0) {
$(".user").show().delay(2000).fadeOut();
}
if (data == "Epass") {
$(".pass").show().delay(2000).fadeOut();
}
if (data == "admin" || data =="other") {
$(".success").show().delay(2000).fadeOut();
if (data == "admin") {
window.location.href = "<?php echo base_url() ?>dashboard";
} else {
window.location.href = "<?php echo base_url() ?>index";
}
};
});
})