jQuery:
var data = JSON.parse(response);
$.each(data, function(i, item) {
alert(data[i].ID);
});
response JSON:
[
{
"ID":"33",
"Serial":"1",
"Purchase_id":"9",
"Item":"ds 18 sticker",
"Unit":"Piece",
"HSN":"84212120",
"Quantity":"110",
"Purchase_rate":"85",
"Discount":"0",
"Discount_2":"0",
"Net_rate":"85",
"CGST_Percentage":"9",
"SGST_Percentage":"9",
"IGST_Percentage":"0",
"Rate_after_tax":"100.3",
"CGST":"841.5",
"SGST":"841.5",
"IGST":"0",
"Net_amount_without_tax":"9350",
"Net_amount":"11033",
"Item_id":"25"
},
{
"ID":"42",
"Serial":"1",
"Purchase_id":"16",
"Item":"ds 18 sticker",
"Unit":"Piece",
"HSN":"84212120",
"Quantity":"1000",
"Purchase_rate":"10",
"Discount":"0",
"Discount_2":"0",
"Net_rate":"10",
"CGST_Percentage":"9",
"SGST_Percentage":"9",
"IGST_Percentage":"0",
"Rate_after_tax":"11.8",
"CGST":"900",
"SGST":"900",
"IGST":"0",
"Net_amount_without_tax":"10000",
"Net_amount":"11800",
"Item_id":"25"
}
]
Anyone can please tell me why it appearing error Uncaught SyntaxError: Invalid or unexpected token. How can I resolve it? and by using each loop how can I get data? sorry for my weak English. Thanks in advance. please edit this question so it can help others.