I'm trying to fetch some data from our database using jQuery's getJSON method. I am able to get a response without issues, but when I try to append it to the page, it's undefined.
Sample json:
{
"ItemCount":1,
"ProductID":"4220002",
"ProdMfg":"",
"Desc":"",
"Quantity":33,
"UnitPrice":1,
"ExtPrice":33
}
jQuery Code:
$.getJSON('webcatpageserver.exe?aShoppingCart', function(data) {
var table = '<table>';
$.each(data, function(index, item) {
table += '<tr><td>' + item.ProductID + '</td><td>' + item.Quantity + '</td> </tr>';
});
table += '</table>';
$("#mini-pallet").append(table);
});
HTML: In the HTML, I see "undefined" displayed.
I assume I'm not accessing the data properly in order to display it - but I could use a push in the right direction. Thanks!
item.ProdID) but there is no such property in the sample json you've provided.