/* Author: Pradeep Khodke URL: http://www.codingcage.com/ */ $('document').ready(function() { /* validation */ $("#login-form").validate({ rules: { password: { required: true, }, user_email: { required: true, email: true }, }, messages: { password:{ required: "please enter your password" }, user_email: "please enter your email address", }, submitHandler: submitForm }); /* validation */ /* login submit */ function submitForm() { var data = $("#login-form").serialize(); $.ajax({ type : 'POST', url : 'login_process.php', data : data, beforeSend: function() { $("#error").fadeOut(); $("#btn-login").html('   sending ...'); }, success : function(response) { if(response=="ok"){ $("#btn-login").html('   Signing In ...'); setTimeout(' window.location.href = "home.php"; ',4000); } else{ $("#error").fadeIn(1000, function(){ $("#error").html('
  '+response+' !
'); $("#btn-login").html('   Sign In'); }); } } }); return false; } /* login submit */ });