Thinkphp+jquery commit how to always show being submitted .....
Here's the jquery code
$.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;
}
}
});
The following is an empty PHP code
Login Verification
Public Function login () {
if (!is_post) {
$array [' msg ']= ' page does not exist ';
$array [' Success ']=0;
$this->ajaxreturn ($array);
}
$user = I (' admin_name ', ' ', ' htmlspecialchars ', ' trim ');
$pass = I (' pwd ', ');
$verify = I (' Authcode ', ' ', ' htmlspecialchars ', ' trim ');
Detection Verification Code
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);
Determine if the password is correct
if (! $admin | | ($admin [' Password '])! = MD5 ($pass)) {
$array [' msg ']=l (' login_fail ');
$array [' Success ']=0;
$this->ajaxreturn ($array);
}
Determine if it is locked
ElseIf ($user [' Islock ']==1) {
$array [' msg ']=l (' login_islock ');
$array [' Success ']=0;
$this->ajaxreturn ($array);
}
}
Verification is verifiable when you click Login, but the username and password is always prompt for "logging in ...."
------to solve the idea----------------------
1. How did you know that the data didn't pass through?
2, the target URL is written right?
/thinkphp/blog/user/login/login???
------to solve the idea----------------------
Verification code can be verified, to verify the password when always prompt logon failure
$user = I (' admin_name ', ' ', ' htmlspecialchars ', ' trim ');
$pass = I (' pwd ', ');
$verify = I (' Authcode ', ' ', ' htmlspecialchars ', ' trim ');
First, the success callback function is removed, the above three variable variables can be printed out in the controller?? If not, go to check the JS section of the code, if possible, check the login code ... You say the verification code can be verified, verify the password error, is not the password to obtain a problem??
------to solve the idea----------------------
View the requested URL address correctly through the browser's debug.