views:

79

answers:

1

This is my ajax call to webservice -JsonWebService.asmx file

 $.ajax({
                    type: "POST",
                    async: false, 
                    url: "/blkseek2/JsonWebService.asmx/GetList",
                    data: keyword2,
                    contentType: "application/xml; charset=utf-8",
                    success: ajaxCallSucceed,
                    dataType: "xml",
                    failure: ajaxCallFailed
                });

This is my method for success ,how will i capture xml response in success method
function ajaxCallSucceed(response) { alert(response.d); /// here i need to write code to capture response xml doc file } This is my code written in webservice jsonwebservice.asmx.cs file,I am able create xml sucess fully but i am finding difficulty in returning xml back to ajax call

[WebMethod]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public XmlDocument GetList(string keyword1, string streetname, string lat, string lng, string radius)
    {
        XmlDocument xmldoc= CreateXML( keyword1,streetname,lat,lng,radius);



        return xmldoc;

    }
+1  A: 

Change your web method as below and try again:

[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Xml)]
public XmlDocument GetList(string keyword1, string streetname, string lat, string lng, string radius) {
    XmlDocument xmldoc = CreateXML(keyword1, streetname, lat, lng, radius);
    return xmldoc;
}
Floyd Pink