I'm using the following code to get some json formatted data:
$.ajax({
type: "GET",
url: "MyService.svc/GetSomeData",
dataType: "text",
success: function (data, textStatus) {
alert("Test: " + data.toString());
},
error: function (xhr, textStatus, errorThrown) {
alert("Error: " + (errorThrown ? errorThrown : xhr.status));
}
});
Data is successfully returned to this call, and it looks like this:
{"d":"test data"}
My guess was that I could access the data as follows:
var myData = data["d"];
However this seems to always return "undefined". What am I missing to get the single string of data "test data"?