This is my ajax call to webservice -JsonWebService.asmx file
这是我对webservice -JsonWebService的ajax调用。asmx文件
$.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
这是我的成功方法,如何在success方法中捕获xml响应
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
这是我用webservice jsonwebservice.asmx编写的代码。cs文件,我可以完全创建xml,但是我发现很难将xml返回到ajax调用
[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 个解决方案
#1
5
Change your web method as below and try again:
更改您的web方法如下所示,然后再试一次:
[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;
}
#1
5
Change your web method as below and try again:
更改您的web方法如下所示,然后再试一次:
[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;
}