$("#sign_in").submit(function(){ var msg = "Please wait..."; var type = "info"; $("#sign_in button[type='submit']").attr("disabled",true); $("#sign_in button[type='submit']").text("Please wait..."); $.ajax({ url:$("#sign_in").attr("action"), type:"post", data:$("#sign_in").serialize(), success:function(msg) { if(msg==1) { var msg = "Login successful
Redirecting to OTP Page..."; var type = "success"; $.notify({ // options message: msg, showProgressbar:true, },{ // settings type: type, animate: { enter: 'animated fadeInDown', exit: 'animated fadeOutUp' }, onShow: function() { this.css({'width':'auto','height':'auto'}); }, }); window.location="otp_page"; } else { var msg = msg; var type = "danger"; $.notify({ // options message: msg, showProgressbar:true, },{ // settings type: type, animate: { enter: 'animated fadeInDown', exit: 'animated fadeOutUp' }, onShow: function() { this.css({'width':'auto','height':'auto'}); }, }); } $("#sign_in button[type='submit']").removeAttr("disabled"); $("#sign_in button[type='submit']").html(" Login"); } }); return false; }); $("#ver_otp").submit(function(){ var msg = "Please wait..."; var type = "info"; $("#ver_otp button[type='submit']").attr("disabled",true); $("#ver_otp button[type='submit']").text("Please wait..."); $.ajax({ url:$("#ver_otp").attr("action"), type:"post", data:$("#ver_otp").serialize(), success:function(msg) { if(msg==1) { var msg = "OTP Verification Successful
Redirecting to dashboard..."; var type = "success"; $.notify({ // options message: msg, showProgressbar:true, },{ // settings type: type, animate: { enter: 'animated fadeInDown', exit: 'animated fadeOutUp' }, onShow: function() { this.css({'width':'auto','height':'auto'}); }, }); window.location="../main"; } else { var msg = msg; var type = "danger"; $.notify({ // options message: msg, showProgressbar:true, },{ // settings type: type, animate: { enter: 'animated fadeInDown', exit: 'animated fadeOutUp' }, onShow: function() { this.css({'width':'auto','height':'auto'}); }, }); } $("#ver_otp button[type='submit']").removeAttr("disabled"); $("#ver_otp button[type='submit']").html(" Login"); } }); return false; }); //session checked function session_check(){ $.ajax({ url: theme_url+'sec_users/check_session', type : 'POST', cache: false, dataType:"json", success: function(data) { if (data.lg == '1') { location.replace(theme_url+'main'); } else { } }, error: function(e) { console.log(e); } }); } setInterval(session_check, 60000);