I have following JSON string returned to a page.
{"firstName":"Bob","lastName":"Gates","department":"Tech"}
I would like to display properties values in a page but I'm having problem.
Here is my jquery ajax
function BuildTable(msg) {
var Person = msg[0];
var table = '<table><tr><td>' + person.firstName + '<td><tr></table>'
$("#temp").html(table);
};
$.ajax({
type: "POST",
url: "../test/json.aspx/testjson",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
BuildTable(msg.d);
}
});
This returns "undefined" although I see JSON string in Firebug. I can return JSON string by using "msg" instead of "Person.firstName"
How do I display property values in JSON string?
Thank you