Ajax User Login function

Source: Internet
Author: User
Tags php file

Today speaking of Ajax to achieve static file landing effect it, first of all, we take the station www.111cn.net landing effect as an example: First look at the Www.111cn.net landing entrance effect:
This seems to be no different from the other, but we carefully look at the original this is a static page of the entrance, the successful landing in this static page to show the effect is that this is the landing of a successful choice to enter the column,

Our main point is to look at this picture, this is the success of the display in the index.html landing, but I would like to affirm that it is not done with the framework, but it is implemented in Ajax, the following we look at its HTML source code we will send in the end of the file has such a piece of coding:
<script language= "JavaScript" >
<!--
function Return_member (str) {
var url= ';
Ajaxcreate ();
if (str==0) {
Url= "/member.php?action=" +math.random ();
}else{
Url= "/user_login.php?pp=" +math.random ();
}
Xmlhttp.open ("Get", url,true);
Xmlhttp.send (NULL);
if (str==0) {
Xmlhttp.onreadystatechange=returnstate;
}else{
Xmlhttp.onreadystatechange=update_login;
}
}

function Returnstate () {
if (xmlhttp.readystate!= 4) {
document.getElementById ("Ajax"). Innerhtml= "Loading data, please later ...";
}
if (xmlhttp.readystate = = 4) {
document.getElementById ("Ajax"). Innerhtml=xmlhttp.responsetext;
}
}
function Update_login () {
if (xmlhttp.readystate = = 4) {
document.getElementById ("Pper"). Innerhtml=xmlhttp.responsetext;
}
}
function Loader () {
Return_member ();
}
-->
</script>
This code url= "/user_login.php?pp=" +math.random (); This is to send the data to the user_login.php file for processing, in fact, PHP files and our normal landing method is no different.

Note: Original works reproduced please specify: www.111cn.net
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.