Thursday, January 10, 2013

Handle Ajax Requests


Handling ajax request with jquery is a easy task. if you have a xml file with id= "Data" have to send as xml document.

XML doucment,
        <xml id="Data"> </xml>

Set oXMLHTTP = CreateObject("Microsoft.XMLHTTP")
oXMLHTTP.open "POST", "/xml/loadZip.asp", False
oXMLHTTP.send Data.XMLDocument

If oXMLHTTP.statusText = "OK" Then
Set oResponse = oXMLHTTP.responseXML.documentElement
Set oStatus = oResponse.selectSingleNode("status")
End If

when you are converting, you can assigne xml document to parameter or can use it directly.In following example I used xml document directly.
  • oXMLHTTP.statusText = "OK" means success: in javascript
    $.ajax({
type: "POST",
async: false,
dataType: "xml",
data: <xml id="Data"> </xml>,
url: "/xml/loadZip.asp",
success: function(data) {
            var oStatus = $(data).find("status").text();
        }
    });

No comments:

Post a Comment