That is because the result is an array, that is being return to your client.
List<userdetails> details = new List<userdetails>();
return details.ToArray();
</userdetails></userdetails>
But you're trying to access an array member of this response array; such as a member
d
of object that is
object[]
. Which is not valid.
Since there is no member
d
for
data
that is returned, that is why it is always showing
undefined to you. Try this code, to get the elements from the list itself...
for (var i = 0; i < data.length; i++) {
$("#tbDetails").append("<table><tbody><tr><td>" +
data[i].Name + "</td><td>" +
data[i].Ln+ "</td><td>" +
data[i].Events +
"</td></tr></tbody></table>");
}
This code would now do the task that you're trying to complete. For more on JavaScript arrays, please refer to following links,
http://javascript.info/tutorial/array[
^]
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Indexed_collections[
^]