mah*_*esh 1 c# xml ajax jquery dhtml
这是我对webservice -JsonWebService.asmx文件的ajax调用
$.ajax({
type: "POST",
async: false,
url: "/blkseek2/JsonWebService.asmx/GetList",
data: keyword2,
contentType: "application/xml; charset=utf-8",
success: ajaxCallSucceed,
dataType: "xml",
failure: ajaxCallFailed
});
Run Code Online (Sandbox Code Playgroud)
这是我成功的方法,我将如何在成功方法中捕获xml响应
function ajaxCallSucceed(response) {
alert(response.d);
/// here i need to write code to capture response xml doc file
}
Run Code Online (Sandbox Code Playgroud)
这是我在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;
}
Run Code Online (Sandbox Code Playgroud)
如下所示更改您的网络方法,然后重试:
[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;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4278 次 |
| 最近记录: |