1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| $.ajax({
url: baseurl + 'index.php?login/ajax_login',
method : 'POST',
dataType: 'json',
encode: true,
cache: false,
data: {
email: $("input#email").val(),
password: $("input#password").val()
},
error: function() {
alert("An error occurred!" );
},
success: function(response)
{
// Login status [success|invalid]
var login_status = response.login_status;
// Form is fully completed, we update the percentage
neonLogin.setPercentage(100);
// We will give some time for the animation to finish, then execute the following procedures
setTimeout(function()
{
// If login is invalid, we store the
if(login_status == 'invalid')
{
$(".login-page").removeClass('logging-in');
neonLogin.resetProgressBar(true);
}
else
if(login_status == 'success')
{
// Redirect to login page
setTimeout(function()
{
var redirect_url = baseurl;
if(response.redirect_url && response.redirect_url.length)
{
redirect_url = response.redirect_url;
}
window.location.href = redirect_url;
}, 400);
}
}, 1000);
}
}); |
Partager