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; } 
0

1 Answer 1

5

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; } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.