Thinkphp+jquery How the submission has been shown is being submitted.

Source: Internet
Author: User
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.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    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.