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

來源:互聯網
上載者:User
thinkphp+jquery提交怎麼一直在顯示正在提交.....
下面是jquery代碼

$.ajax({
type: "POST",
url: "/thinkphp/blog/User/Login/login",
dataType: "json",
data: {"user":admin_name,"pwd":admin_pass,"authcode":authcode},
beforeSend: function(){
$('').addClass("loading").html("{:L('login_')}").css("color","#FF0000").appendTo('.login_btn');
},
success: function(json){
if(json.success==1){
$("#msg").remove();
$('').addClass("notice_y").html(json.msg).appendTo('.div_c').fadeOut(3000);
location.href="{:U('Index/index')}";
}else{
$("#msg").remove();
$('').addClass("notice").html(json.msg).css("color","#FF0000").appendTo('.div_c').fadeOut(3000,function(){
return false;
});
//location.href="{:U('Login/index')}";
//return false;
}
}
});

下面是空php代碼

//登陸驗證
public function login(){
if(!IS_POST){
$array['msg']='頁面不存在';
$array['success']=0;
$this->ajaxReturn($array);
}
$user = I('admin_name','','htmlspecialchars','trim');
$pass = I('pwd','');
$verify = I('authcode','','htmlspecialchars','trim');
//檢測驗證碼
if(!check_verify($verify)){
$array['msg']=L('login_vcode_error');
$array['success']=0;
$this->ajaxReturn($array);
}
$admin = M('admin')->where(array('username'=>$user))->find();
//dump($admin);
//判斷密碼是否正確
if(!$admin || ($admin['password']) != md5($pass)){
$array['msg']=L('login_fail');
$array['success']=0;
$this->ajaxReturn($array);
}
//判斷是否被鎖定
elseif($user['IsLock']==1){
$array['msg']=L('login_IsLock');
$array['success']=0;
$this->ajaxReturn($array);
}
}

在點擊登入的時候驗證是可以驗證,但是使用者名稱密碼這塊一直提示“正在登入....”
------解決思路----------------------
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地址是否正確。
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.