JQuery AJAX responseText to JSON
- by BoredOfBinary
I have this script that calls a .net WebService
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
);
And I recieve the following value in the msg variable:
""{\"d\":\"{\\"ComponentId\\":994,\\"Latitude\\":32.219627009236405,\\"Longitude\\":-110.96843719482422,\\"LocationName\\":\\"Tucson\\",\\"StreetAddress\\":\\"7201 E 22nd Street \\",\\"City\\":\\"Tucson\\",\\"State\\":\\"AZ\\",\\"PostalCode\\":null}\"}""
I have no idea why this would format this way, seems to only do this in responseText.
Does anyone have any ideas?