Copy Code code as follows:
First step: Create a XMLHttpRequest Object
var http_request;
Try
{
http_request = window. ActiveXObject ("Microsoft.XMLHTTP");
}catch (e)
{
Try
{
Http_request = new XMLHttpRequest ();
}catch (e)
{
Alert ("Your browser does not support XMLHttpRequest");
}
}
Step two: Specify the URL to submit
Http_request.open ("Get", "url", "true"); Get is the way to commit, true to specify asynchronous to server interaction
Step three: Process Server return Data
Http_request.onreadystatechange = function ()//callback function, which will be called 4 times, readtstate in turn: 0-> 1-> 2-> 3-> 4 (complet ED);
{
if (http_request.readystate ==4)//server processing complete
{
if (Http_request.status = = 200)//Client processing complete
{
Working with segments
}
}
}
Fourth step: Send Parameters
Http_request.send (NULL); Send parameters