Ajax+php to create progress bar readystate _php skills of each State

Source: Internet
Author: User
Using ajax+php to build progress bar is actually very simple.
ReadyState = = Status (0,1,2,3,4)
0: Request uninitialized, not called open
1: The request has been established, but has not been sent yet, send has not been called
2: The request has been sent and is being processed
3: Request is being processed, usually some data in the response can be called
4: Finished
Copy Code code as follows:

var xmlHttp;
function Create ()
if (window. ActiveXObject)
{
XmlHttp = new ActiveXObject ("Microsoft.XMLHTTP");//ie browser
}
Else if (window. XMLHttpRequest)
{
XmlHttp = new XMLHttpRequest ()//Non IE browser
}
}
function Request (URL)
{
Xmlhttp.open ("Get", "for.php?id=" +url,true);//true is asynchronous transfer
Xmlhttp.onreadystatechange = ip985;//response function
Xmlhttp.send (NULL);
}
Function ip985 ()
{
if (xmlhttp.readystate==1)
{
document.getElementById (' IP985 '). Innerh TML = "Request established, ready to send ..."; IP985 flag bit
}
if (xmlhttp.readystate==4)
{
var v = xmlhttp.responsetext;//Get content
Document.getele Mentbyid (' ip985 '). InnerHTML = v;//Destination Web page content
}

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.