The following works, if I have something like this:
return Json(new { CustomerInfo = custinfo}); // defined in the controller
// below I define in my client script
jQuery.each(CustomerInfo, function () {
jQuery.each(this, function () {
// get field info from the object
});
});
But, if I pass back 2 pieces of data as such
return Json(new { CustomerInfo = custinfo, Message = msg });
Note that custinfo is a list and message is a string
In my .ajax() I have the following with retrieves information from the JSON
function (data) {
alert(data.Message); // show up fine
alert(JSON.stringify(data.RepInfo));
jQuery.each(data.CustomorInfo, function () {
jQuery.each(this, function () {
// get data for each field . Show up as undefined here for my row content
});
});
}
If I do alert on JSON.stringify on the above code I get get the following:
[{"ID":"12","Date":"01/23/2012","City":"Clearwater","State":"FL"},{"ID":"00017-LV01-12","Date":"02/09/2012","City":"Peoria","State":"IL"},{"ID":"00010-LV01-12","Date":"06/22/2012","City":"Newport Beach","State":"CA"}]
When I view the data wihin .each() it is pulling undefined for the row content.
How can I get it to show the content of the rows.
you can try this:
live demo : http://jsfiddle.net/PQcFx/18/