Home > Backend Development > PHP Tutorial > thinkphp+jquery提交如何一直在显示正在提交.

thinkphp+jquery提交如何一直在显示正在提交.

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 12:24:24
Original
802 people have browsed it

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 />
Copy after login

下面是空php代码
<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 />
Copy after login

在点击登录的时候验证是可以验证,但是用户名密码这块一直提示“正在登录....”
------解决思路----------------------
1、你是怎么知道数据没有传过去的?
2、目标 url 写的对吗?
/thinkphp/blog/User/Login/login ???

------解决思路----------------------
验证码是可以验证,到验证密码的时候总是提示登录失败
        $user = I('admin_name','','htmlspecialchars','trim');
        $pass = I('pwd','');
        $verify = I('authcode','','htmlspecialchars','trim');
先把success回调函数去掉,上面三个变量变量能不能在控制器打印出来??如果不能,去检查js部分的代码,如果能,检查login的代码。。。你说验证码可以验证,验证密码出错,是不是密码获取出了问题??
------解决思路----------------------
通过浏览器的debug查看请求的url地址是否正确。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template