Home  >  Article  >  Backend Development  >  thinkphp与jquery,该如何解决

thinkphp与jquery,该如何解决

WBOY
WBOYOriginal
2016-06-13 11:22:331060browse

thinkphp与jquery
页面代码为:

<form action="__URL__/login_in" method="post" name="form1"><br />                    邮箱<input type="text" name="email" id="email" class="inpt"><span class="emailmsg"></span><br/><br />                    密码<input type="password" name="pwd" id="pwd" class="inpt"><span class="pwdmsg"></span><br/><br />                    <input type="button" value="" id="ulogin" class="log" ><br />                </form>

jquery事件代码:
	$("#ulogin").click(function(){<br />		$.ajax({<br />			url:"./index.php/User/logincheck",<br />			type:"POST",<br />			data:{email:$("#email").val(),pwd:$("#pwd").val()},<br />			//dataType:'text',<br />			//timeout:1000,<br />			error:function(){<br />				alert('请求错误');<br />				return false;<br />			},<br />			success:function(data){<br />				$('.emailmsg').html(data);<br />				//return false;<br />			}<br />		});<br />	});

logincheck的方法如下:
public function logincheck(){
$email=$_POST['email'];
$pwd=md5($_POST['pwd']);
$user=M('User');
$list=$user->where('email=$email')->find();
if(empty($list)){
echo '该用户不存在';
exit;
}
$list=$user->where('email=$email and pwd=$pwd')->find();
if(empty($list)){
echo '密码错误';
exit;
}
}

因为在User模块里面有设置_empty()方法,所以每次点击后老是会出现_empty()方法中echo出的内容。哪位大神指导下!

thinkphp jQuery
Statement:
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