Hello,
I am using JQuery to execute an operation within a web service. After writing data back to my databaes, the service returns a JSON response. My request looks like the following:
$.ajax({
url: "/services/myService.svc/PostMessage",
type: "POST",
contentType: "application/json; charset=utf-8",
data: '{"message":"testing","comments":"test"}',
dataType: "json",
success: function (response) {
if ((response.d != null) && (response.d.length > 0)) {
// Parse the status code here
}
else { alert("error!"); }
},
error: function (req, msg, obj) {
alert("error: " + req.responseText);
}
});
When my response is returned, response.d contains the following:
[{"StatusCode":1}]
How do I parse out the value of the StatusCode?