PHP头条
热点:

thinkphp与jquery,该如何解决


thinkphp与jquery
页面代码为:

                    邮箱

                    密码

                    
                

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

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 分享到:
------解决方案--------------------
把action= “”试试
------解决方案--------------------
把你那ajax里的url写成绝对路径,

再不行那就真不行了。
------解决方案--------------------
为什么会出现空操作?LZ你怎么想?
------解决方案--------------------
能不能执行到你的logincheck方法?
------解决方案--------------------
Nice,不错的,收藏了
------解决方案--------------------
那个应该是action的问题,你改成绝对路径或者用:U(“***”)生成路径试试看

www.phpzy.comtrue/phprm/21207.htmlTechArticlethinkphp与jquery,该如何解决 thinkphp与jquery 页面代码为: 邮箱 密码 jquery事件代码: $("#ulogin").click(function(){ $.ajax({ url:"./index.php/User/logincheck", type:"POST", data:{email:$("#email").val(),pwd:$("#pwd").v...

相关文章

PHP之友评论

今天推荐