Native Ajax notation (Ajax status values)

Source: Internet
Author: User
Tags ajax status code

1, IE5, 6 Use ActiveX (window. ActiveXObject)

Version: msxml2.xmlhttp.6.0 msxml2.xmlhttp.3.02, other major browsers: built-in constructors (window. XMLHttpRequest) Create objects for all browsers function createxmlhttprequest ()
{
if (window. XMLHttpRequest)
{
var ohttp = new XMLHttpRequest ();
return ohttp;
}
else if (window. ActiveXObject)
{
var versions=["msxml2.xmlhttp.6.0",
"Msxml2.xmlhttp.3.0"
];
for (Var i=0;i < versions.length;i++)
{
try{
var ohttp= new ActiveXObject (Versions[i]);
return ohttp;
}
catch (Error) {
Do nothing here

}
}
}
return null;
} 3, open (requesttype,url,ture/false(Asynchronous/Sync); method initializes the object 4, the way to synchronize the request var ohttp = Createxmlhttprequest ();//Synchronous request
Ohttp.open ("GET", "Http://localhost/myTextFile.txt", false);
Ohttp.send (NULL);
if (Ohttp.status = = 200)
{
Alert ("The text was found!");
}
else if (ohttp.status==404) {
Alert ("The text file could not being found!");
}
else{
               alert ("The server returned a Status code of "+ohttp.status";    }   5, Ajax status value 0-(uninitialized) has not yet called Send () Method 1-(load) called Send () method, sending request 2-(load complete) the Send () method executes, has received full response content 3-(interaction) is parsing the response content 4-(completion) Response content resolution completed, can be called on the client    6, HTTP status Code 3-AJAX status code Description  1**: Request received, continue processing 2**: Operation received successfully, analysis, accept 3**: The request must be processed further 4**: The request contains an error syntax or cannot be completed 5**: The server performs a fully valid request failure 100 --The customer must continue to make a request 101--client requests that the server convert the HTTP protocol version 200--transaction success 201--prompt to know the url202--acceptance and processing of the new file, but processing incomplete 203--return information indeterminate or incomplete 204--request received, But the return information is empty 205--the server completes the request, the user agent must reset the currently browsed file 206--the server has completed a partial user's GET request 300--the requested resource can get 301--delete request data in multiple locations 302--found the request data at other addresses 303- -Advise clients to access other URLs or access methods 304--the client has performed a get, but the file has not changed 305--the requested resource must be 306--the code used in the previous version of HTTP from the address specified by the server and is no longer used in the current version 307-- Declare the requested resource temporary delete 400--error request, such as syntax error 401--request authorization failed 402--retain valid Chargeto header response 403--request does not allow 404--no discovery file, query, or url405-- The method defined by the user in the Request-line field does not allow 406--to request the resource to be inaccessible based on the accept drag sent by the user 407--similar to 401, the user must first be authorized on the proxy server 408--the client does not complete the request within the user-specified time of starvation 409-- The request cannot be completed on the current resource state 410--server no longer has this resource and no further reference address411--server rejects a user-defined Content-length property request 412--One or more request header fields in the current request error 413--the requested resource is greater than the server allowed size 414--The requested resource URL is longer than the length allowed by the server 415-- The request resource does not support the request Item format 416--request contains a range request header field that does not have a range indication value within the current request resource scope, and the request does not contain the If-range request header field 417--The server does not meet the expected value specified by the request Expect header field. If it is a proxy server, the next level of server may not meet the request 500--server generates an internal error 501--the server does not support the requested function 502--the server is temporarily unavailable, sometimes to prevent the system overload 503--server overload or pause maintenance 504--Gateway overload, The server responds to the user with another gateway or service, and the wait time setting is longer 505--the server does not support or denies the HTTP version specified in the request header  jqurey implement Level 3 linkage------------ http:// Www.cnblogs.com/bestsamcn/p/4804864.html

Native Ajax notation (Ajax status values)

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.