How to return xml data document constructed on the webservice to clientside ajax jquery call
I have a webmethod which is trying to construct xml data document and return to clientside but I am not able to guess whether the error is on clientside call or webservice return method. can anyone help to sortout this logic
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Xml)]
public XmlDataDocument GetList(string keyword1, string streetname, string lat, string lng, string radius)
{
XmlDataDocument xmlDoc= CreateXML( keyword1,streetname,lat,lng,radius);
//save file to application folder which will be refferd by client application
xmlDoc.Save(@"D:\blockseek7-9-2010\Block3.xml");
//xmlDoc.LoadXml(
return xmlDoc;
}
This is my call on clientside
var keyword2 = "{\"keyword1\":\"" + keyword1 + "\",\"streetname\":\"" + address1 + "\",\"lat\":\"" + lat + "\",\"lng\":\"" + lng + "\",\"radius\":\"" + radius + "\"}";
$.ajax({
type: "POST",
async: false,
url: "http://localhost:2330/blockseek7-9-2010/JsonWebService.asmx/GetList",
data: keyword2,
contentType: "application/json; charset=utf-8",
dataType: "json",
failure: ajaxCallFailed,
success: ajaxCallSucceed
});
});
This is the function for the ajaxCallSucceed
function ajaxCallSucceed(response) {
//alert("hi");
GDownloadUrl(response.xml, function(data) {
var xml = GXml.parse(response.xml);
var markers = xml.documentElement.getElementsByTagName('marker');
map.clearOverlays();
var sideba开发者_运维知识库r = document.getElementById('sidebar');
sidebar.innerHTML = '';
alert(markers.length);
.......... ............ .......................... ..................................
Use tool such as Fiddler or FireBug add-on for FireFox - this will allow you to inspect each request/response. By looking at response to your web service call, you will know the xml returned. That will help you in determining whether the issue is on server side or on client side.
精彩评论