ajax|asp.net|xml| Asynchronous
Ajax is intended to be used to get XML content asynchronously to achieve a web-without-refresh effect
asp.net Ajax has encapsulated the underlying content
The implementation is far more convenient than writing XMLHTTP, at least the browser compatibility is much stronger
Here's a www.asp.net example of how to use a Microsoft Ajax library to get an XML document simple and asynchronous
//return XML Web request
Function onsucceededxml (executor, EventArgs)
... {
if (executor.get_responseavailable ())
... {
if (document.all)
Resultelementid.innertext + = Executor.get_xml ( ). xml;
Else
//Firefox
Resultelementid.textcontent + = "First node[node]:" +
executor.get_xml (). Documentelement.nodename;
}
else
... {
if (executor.get_timedout ())
alert ("timeout");
Else
if (executor.get_aborted ())
alert ("failure");
}
}
Function GetXml ()
... {
//Create WebRequest object
wrequest = new Sys.Net.WebRequest ();
Set up request files
Wrequest.set_url ("Index.xml");
Set the request handler.
Wrequest.add_completed (Onsucceededxml);
Clear the results area.
if (document.all)
Resultelementid.innertext = "";
Else
Firefox
Resultelementid.textcontent = "";
Invoke the WEB request.
Wrequest.invoke ();
}
>Xml