JS Classification has a section "Native JS asynchronous request, XML parsing" mainly explains how JS foreground processing XML format request and how to accept the XML data returned by the server parsing, today I will use an example to illustrate how to do.
The parameter type of the foreground is also XML using jquery:
function test () { var xmlstring = "<bookstore>" + "<book type= ' compulsory course ' isbn= ' 7-111-19149-2 ' >" + " <title> Data Structures </title> "+ " <author> Min </author> "+ " <price>30.00</price > "+ " </book></bookstore> "; $.ajax ({type: "post", url: "Hand/ajax.ashx", Data: "Strxml=" +xmlstring,datatype: "xml", Success:function (XML) {// Update the page alert ("Success") according to Resulttext, alert ($ (XML). Find (' Table1 '). Find (' title '). Text ());},error:function ( Xmlresponse) {alert (Xmlresponse.responsetext)}});}
The foreground is in the XML format parameters, how to do in the background? This is for XML read-write, here is a simple explanation:
XmlDocument Xdoc = new XmlDocument (); Xdoc. LOADXML (strxml);//Read XML string Strxmlxdoc. Load (filename);//Read XML file filename is the path to the file
Ajax implementation Asynchronous Operation instance _ request data for XML format