I want to extract data from Json array and append it with html table with jquery like
- idly 5
- dosa 20
This is how my browser console prints what my server returned
{hotelMitem: Array(5)}
hotelMitem: Array(5)
0: {hname: "idly", iprice: "5"}
1: {hname: "dosa", iprice: "20"}
2: {hname: "dosa", iprice: "20"}
3: {hname: "dosa", iprice: "20"}
4: {hname: "dosa", iprice: "20"}
length: 5
__proto__: Array(0)
__proto__: Object
But when i try to iterate & print with jQuery
var _jsonString = "";
for(var key in data){
_jsonString +="key "+key+" value "+data[key]+ '</br>';
}
$("#datatable").append(_jsonString)
HTML OUTPUT what i get
key hotelMitem value [object Object],[object Object],[object Object],[object Object],[object Object]