function Loadxmldoc (url,callbackfunc)
{
if (window. XMLHttpRequest)
{//ie7+, Firefox, Chrome, Opera, Safari code
Xmlhttp=new XMLHttpRequest ();
}
Else
{//IE6, IE5 code
Xmlhttp=new ActiveXObject ("Microsoft.XMLHTTP");
}
Xmlhttp.onreadystatechange=callbackfunc;
Xmlhttp.open ("GET", url,true);
Xmlhttp.send ();
}
------------------------------------Split Line---------------------------------------------------------------------------------- ------
A personal understanding of the callback function:
The callback function, which is literally understood, even calls this function back. By using a function pointer as a parameter to a function, this pointer acts as an interface.
If the callback function is bound to the onReadyStateChange event----Here This callback function is equivalent to an event listener and an operation interface, and when we need to do something about a value of an event, we define the corresponding callback function.
Back to the abstract, if the function A's callback function pointer is b), a in the completion of the function declaration, the definition of its execution code (that is, function A is a fixed method), B as a parameter, B can be defined outside the function, as a parameter passed into the inside of function A, Additional operations are performed by some of the variable values derived from function A.
Think of two comparison image of the metaphor, but also through other blog ideas evolved, 1 function A is equivalent to a ceramic factory, callback function B is a mold factory, porcelain factory dug to the mold factory processing, mold factory processed and then sent to the porcelain factory processing refined into finished porcelain, this is called customizable.
One more thing, like I have a circuit system a, when the system load to a certain threshold, it is necessary to pass through the circuit system of the reserved interface to a variety of measuring instrument detection circuit security.
Beginner Javasript, some humble opinion, understand the wrong place hope to get all the way big God big fairy or monsters (¬_¬)! Please advise to correct!
To create a XMLHttpRequest object write a standard function