When registering a user, does email always fail to pass verification and the function fails?

Source: Internet
Author: User
When registering a user, does email always fail to pass verification and the function fails?
// Check your email address $ ("# email"). blur (function () {var reg =/^ [\ w. \-] + @(? : [A-z0-9] + (? :-[A-z0-9] +) * \.) + [a-z] {} $/; if ($ ("# email"). val ()! = ""&&! Reg. test ($ ("# email"). val () {$ ("# email1" ).html ("the email format is incorrect! "); $ (" # Okemail "). hide (); return false ;}$. post ('{: U ("Register/checkEmail")}', $ ("# register "). serialize (), function (str) {str = $. trim (str); $ ("# email1" ).html ("" + str + ""); $ ("# okemail "). hide (); if (! Str) {email = 1; $ ("# okemail"). show ();}});});


Ask,
When registering a user, the email always cannot be verified,
What is '{: U ("Register/checkEmail? It seems to have failed. how can we make it work properly?


Reply to discussion (solution)

{:U("Register/checkEmail")}

This is the routing function of the THINKPHP framework. if you do not use this framework, it is definitely invalid and an error is returned.

Or is there a problem with the code $ ("# register"). serialize?
It seems that the verification has passed, and the email format is correct and there are no duplicates, but the exclamation mark is still on the right of the text box, not green,
As a result, when you click the Register button, the message "Please fill in the complete registration information" is displayed ".

Val = 'ABC @ example.com ';
Var pattern =/^ \ w + (-\ w +) | (\. \ w +) * \ @ [A-Za-z0-9] + ((\. |-) [A-Za-z0-9] + )*\. [A-Za-z0-9] + $ /;
Return pattern. test (val );

Val = 'ABC @ example.com ';
Var pattern =/^ \ w + (-\ w +) | (\. \ w +) * \ @ [A-Za-z0-9] + ((\. |-) [A-Za-z0-9] + )*\. [A-Za-z0-9] + $ /;
Return pattern. test (val );



The regular expression cannot be changed as you do.

{:U("Register/checkEmail")}

This is the routing function of the THINKPHP framework. if you do not use this framework, it is definitely invalid and an error is returned.



The THINKPHP framework is correct. There is no text error, that is, an exclamation point on the right. The reason is unknown.


{:U("Register/checkEmail")}

This is the routing function of the THINKPHP framework. if you do not use this framework, it is definitely invalid and an error is returned.



The THINKPHP framework is correct. There is no text error, that is, an exclamation point on the right. The reason is unknown.

You only need to submit an email in the form to your method for verification, and you don't need to serialize all of them before submitting them? In addition, does the submitted field match the field you obtained? After looking at these issues, we can see where the problem is.
Related Article

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.