"Copper" 134th one-to-one video recording and AJAX implementation registration Sunday

Source: Internet
Author: User

Key Words: One-to-one video recording , Ajax Implement registration

I. Video recording

1.1 needs to do.

Second,network

2.1 Ajax implement the registration as follows:

1 ) Register HTML

Registration Please fill in:

User name:<input type= "text" placeholder= " Please enter user name " id= "username1"

Name= "username" ><br>

Name:<inputtype= "text" placeholder= " Please enter nickname " id= "Nick1" name= "Nick" ><br>

Mail box:<inputtype= "text" placeholder= " Please enter the mailbox " id= "Email1"

Name= "Email" ><br>

Tel :<inputtype= "text" placeholder= " Please enter phone " id= "Mobile1"

Name= "mobile" ><br>

Secret code:<inputtype= "password" placeholder= " Please enter the password " id= "Pass1"

Name= "Pass" ><br>

Confirm Password:<inputtype= "password" placeholder= " Please enter the password again " id= "PASS21"

Name= "Pass2" ><br>

<buttonid= "Formsubmit" onclick= "tabsubmit()" > submit </button>

2) Tabsubmit The functions are as follows:

function Tabsubmit () {

var Unamev =document.getelementbyid ("username1"). Value;

VARNICKV = document.getElementById ("Nick1"). Value;

Varemailv = document.getElementById ("Email1"). Value;

Varmobilev = document.getElementById ("Mobile1"). Value;

VARPASSV = document.getElementById ("Pass1"). Value;

VARPASS2V = document.getElementById ("Pass21"). Value;

Varform = new FormData ();

Form.append ("username", UNAMEV);

Form.append ("Nick", NICKV);

Form.append ("email", emailv);

Form.append ("mobile", Mobilev);

Form.append ("Pass", PASSV);

Form.append ("Pass2", pass2v);

$. Ajax ({

URL: "/0web/index.php/user/userregdata/saveuserinfo",

Type: "Post",

Data:form,

Processdata:false,

Contenttype:false,

Success:function (data) {

if (data = = 1001) {

Alert (' you have filled in the phone number or nickname already exists, please check and re-fill!!! ');

}else if (data ==1002) {

Alert (' Insert succeeded! ');

Self.location= "http://127.0.0.1/0Web/";// do not jump directly to the current page top off

}else{

Alert (' system error, please try again later! ');

}

},

Error:function (e) {

Alert (" Error!! ");

}

});

}

Note: This Ajax -enabled INSERT, after inserting successfully, can jump to the first page.

3 ) The relevant interfaces are as follows:

Save user Information

Public Function Saveuserinfo () {

$data = $this->input->post ();

$username = $this->input->post ("username");

$nick = $this->input->get_post ("Nick");

$email = $this->input->post ("email");

$mobile = $this->input->get_post ("mobile");

$pass = MD5 ($this->input->post ("Pass"));

$pass 2 = MD5 ($this->input->post ("Pass2"));

$boolNick = $this->usrgdtm->selectuser (' Nick ', $nick);

$boolMobile = $this->usrgdtm->selectuser (' mobile ', $mobile);

if ($boolNick | | $boolMobile) {

1001 indicates that a nickname or mobile number already exists

$ret = 1001;

}else{

$bool = $this->usrgdtm->saveuser ($username, $nick, $email, $mobile, $pass, $pass 2);

if ($bool) {

1002 Insert Success

$ret = 1002;

}else{

1003 Insert Failed

$ret = 1003;

}

}

echo Json_encode ($ret);

}

year 5 month Sunday

436 Word bronze

"Copper" 134th one-to-one video recording and AJAX implementation registration Sunday

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.