Jquery does not require any new verification email address implementation instance

Source: Internet
Author: User

During development today. The email address must be verified by the user. However, if the traditional js node is used, you need to clear the browser cache for normal verification. So you can use jquery to write a refresh-free verification.

Copy codeThe Code is as follows:
<Script type = "text/javascript">
Var ee;
Function mailbox (strEmail ){
Var name = document. blooger [0]. email. value;
$. Ajax ({
Type: "get ",
Url: "<? Php echo "http: //". $ _ SERVER ['HTTP _ host']. "/Login/";?> Mail. php ",
Data: "youx =" + name,
Success: function (datax ){
Var xx = document. getElementsByName ("email") [0]. value;
If (xx = "") {document. getElementById ("mailbox_msg"). innerHTML = '<font color = red> the mailbox cannot be blank! </Font> ';}
Else if (document. blooger [0]. email. value. search (/^ w + (-w +) | (. w +) * @ [A-Za-z0-9] + ((. |-) [A-Za-z0-9] + )*. [A-Za-z0-9] + $ /)! =-1 ){

If (datax = 0 ){
Document. getElementById ("mailbox_msg"). innerHTML = '<font color = red> email has been registered </font> ';
}
Else {document. getElementById ("mailbox_msg"). innerHTML = '<font color = green> email can be used! </Font> ';}
} Else {document. getElementById ("mailbox_msg"). innerHTML = '<font color = red> Incorrect email address </font> ';}
}
});

}

Function check (){
If (ee! = "1") {mailbox (); return false ;}
}
</Script>

Then this is the html code.

Copy codeThe Code is as follows:
<Form name = "blooger" action = "blogger. php? Action = update "method =" post "id =" blooger "enctype =" multipart/form-data "onsubmit =" return check (); ">
<Div class = "item_edit"> www.jb51.net
<Li>
<? Php echo $ icon;?> <Input type = "hidden" name = "photo" value = "<? Php echo $ photo;?> "/>

Avatar

<Input name = "photo" type = "file"/> (JPG and PNG images are supported)
</Li>
<Li> nickname
<Input maxlength = "50" style = "width: 185px;" value = "<? Php echo $ nickname;?> "Name =" name "/> </li>
<Li> email
<Input type = "text" name = "email" value = "<? Php echo $ email;?> "Id =" id_mailbox "style =" width: 185px; "maxlength =" 200 "onBlur =" mailbox (this. value); "/> <span id =" mailbox_msg "> </span> </li>
<Li> personal description
<Textarea name = "description" style = "width: 300px; height: 65px;" type = "text" maxlength = "500"> <? Php echo $ description;?> </Textarea> </li>
<Li> <input type = "submit" value = "save data" class = "button"/> </li>
</Div>
</Form>

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.