That is because you first need to convert the JSON data to an Object in JavaScript. Once you convert it to an Object, then you can call this property. The data that comes from your web server is in the form of JSON, and which would be considered as a string on the client-side; JavaScript.
As it is, the
data
object (because it is considered as a plain-variable; more like a string and it) doesn't have any member
d
in it. That is why JavaScript shows
undefined
when you try to display the values.
For example the following code,
success: function (data) {
var obj = JSON.parse(data);
alert(obj.d);
}
One last thing, the JSON data that you're having is an array containg 3 objects, so it would be good to first get the object at index, and then check for the property. Something like this.
var obj = JSON.parse(data);
var firstObj = obj[0];
alert(firstObj.Id);
You can always learn more about JSON notation in browsers; W3.Org standards, from Mozilla Developer Network.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse[
^]
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify[
^]
Or you can at the same time learn the JSON syntax to learn more on how objects are serialized and deserialized and how the members are treated from the
JSON.org[
^].