I have an ajax fn. My data variable gives me this response
[{"id":1,"name":"x"},{"id":2,"name":"y"},{"id":3,"name":"z"}]
How do I get id,name. I tried using
JSON.Parse(data[i])
for(var i=0; i <data.length; i++){
console.log(data[i].id);
}
My console says unexpected end of data.