I am getting Json Data from WCF service. But I unable to extract/parse data in Jquery Ajax Call?
Ajax:
$.ajax({
type: 'GET',
contentType: 'application/json; charset=utf-8',
url: './Services/Service.svc/GetUserDetails',
data: { uname: 'e0205' },
async: false,
dataType: 'json',
success: function (response) {
//var testMsg = $.parseJSON(response);
alert(response.GetUserDetailsResult);
},
error: function (error) {
alert(error);
}
});
Json Data :
{"GetUserDetailsResult":"{\"Table\":[{\"UserName\":\"E0205\",\"EmpName\":\"Manjeet\",\"LocationName\":\"Gurgaon\",\"Designation\":\"Analyst\"}]}"}
Kindly suggest any possible ways. Thanks in advance.
VijayPosted Jun 2, 2016, 7:13 AM
Francis SusaimichaelPosted Jun 2, 2016, 6:57 AM
Just check youweb service returnedcorrect JSON format. You can checkit in thebelow online editor:
VijayPosted Jun 2, 2016, 6:40 AM
Francisi unable to parse like that format too
Francis SusaimichaelPosted Jun 2, 2016, 4:32 AM
Just replaces theslasesusing JS and then try to parse:
http://stackoverflow.com/questions/21036626/remove-backslashes-from-json-data-in-javascript
VijayPosted Jun 2, 2016, 3:00 AM
Francis SusaimichaelPosted Jun 2, 2016, 2:20 AM