我有这个脚本调用.NET的WebServiceJQuery的AJAX的responseText以JSON
msg = $.toJSON(
$.ajax({
type: "POST",
url: "http://[url]/ETS.UI/WebServices/LocationService.asmx/GetMappingLocationDetails",
contentType: "application/json; charset=utf-8",
data: $.toJSON({'componentId':994}),
dataType: "json",
async: false
}).responseText
);
我收到的msg变量以下值:
""{\"d\":\"{\\\"ComponentId\\\":994,\\\"Latitude\\\":32.219627009236405,\\\"Longitude\\\":-110.96843719482422,\\\"LocationName\\\":\\\"Tucson\\\",\\\"StreetAddress\\\":\\\"7201 E 22nd Street \\\",\\\"City\\\":\\\"Tucson\\\",\\\"State\\\":\\\"AZ\\\",\\\"PostalCode\\\":null}\"}""
我不知道为什么这将以这种方式格式化,似乎只在responseText中执行此操作。
有没有人有任何想法?
您不应该使用同步AJAX调用;他们会完全冻结浏览器。 – SLaks 2010-04-23 22:07:13
问题是我在绘制地图上的位置数据的循环语句中。 – BoredOfBinary 2010-04-23 22:11:16