Heim >Backend-Entwicklung >PHP-Tutorial >thinkphp+jquery提交如何一直在显示正在提交.
thinkphp+jquery提交怎么一直在显示正在提交.....
下面是jquery代码
<br />$.ajax({<br /> type: "POST",<br /> url: "/thinkphp/blog/User/Login/login",<br /> dataType: "json",<br /> data: {"user":admin_name,"pwd":admin_pass,"authcode":authcode},<br /> beforeSend: function(){<br /> $('<div id="msg" />').addClass("loading").html("{:L('login_')}").css("color","#FF0000").appendTo('.login_btn');<br /> },<br /> success: function(json){<br /> if(json.success==1){<br /> $("#msg").remove();<br /> $('<div id="div-y" />').addClass("notice_y").html(json.msg).appendTo('.div_c').fadeOut(3000);<br /> location.href="{:U('Index/index')}";<br /> }else{<br /> $("#msg").remove();<br /> $('<div id="div-b" />').addClass("notice").html(json.msg).css("color","#FF0000").appendTo('.div_c').fadeOut(3000,function(){<br /> return false;<br /> });<br /> //location.href="{:U('Login/index')}";<br /> //return false;<br /> }<br /> }<br /> });<br />
<br />//登陆验证<br /> public function login(){<br /> if(!IS_POST){<br /> $array['msg']='页面不存在';<br /> $array['success']=0;<br /> $this->ajaxReturn($array);<br /> }<br /> $user = I('admin_name','','htmlspecialchars','trim');<br /> $pass = I('pwd','');<br /> $verify = I('authcode','','htmlspecialchars','trim');<br /> //检测验证码<br /> if(!check_verify($verify)){<br /> $array['msg']=L('login_vcode_error');<br /> $array['success']=0;<br /> $this->ajaxReturn($array);<br /> }<br /> $admin = M('admin')->where(array('username'=>$user))->find();<br /> //dump($admin);<br /> //判断密码是否正确<br /> if(!$admin || ($admin['password']) != md5($pass)){<br /> $array['msg']=L('login_fail');<br /> $array['success']=0;<br /> $this->ajaxReturn($array);<br /> }<br /> //判断是否被锁定<br /> elseif($user['IsLock']==1){<br /> $array['msg']=L('login_IsLock');<br /> $array['success']=0;<br /> $this->ajaxReturn($array);<br /> }<br /> }<br />