Use of ajax post xml Method
Function postdata (url, posteddata)
{
Var xmlhttprequest = createxmlhttprequest ();
// Call the encodeuri method twice
Posteddata = encodeuri (posteddata );
Posteddata = encodeuri (posteddata );
Var url = url;
// Send a request to a specified url. "true" indicates that the request is asynchronous.
Xmlhttprequest. open ("post", url, true );
// Set the post submission item
Xmlhttp. setrequestheader ("content-type", "text/xml ");
// Set a callback function to process the returned results
Xmlhttprequest. onreadystatechange = function () {callback (xmlhttprequest )};
Xmlhttprequest. send (posteddata );
}
Createxmlhttprequest () and callback () are the correct codes.
The postdata () is called on the asp tutorial x page as follows:
Function getchangedcontent ()
{
Var posteddata = document. forms [0]. tl. func ("getchangedxml", "2 ");
Alert (posteddata );
Postdata ("f_calcreport.aspx", posteddata );
}
The server obtains the following code:
Private void modifydata ()
{
Try
{
Xmldocument document = new xmldocument ();
Document. load (request. inputstream );
}
Catch (exception e)
{
Response. write (e. message );
}
}