I am running a $.get call to get data from a php file:
$.get("test.php", { home_type: home_info[0], home_community: home_info[1] }, function(data) {
console.log(data);
});
and it returns this data:
[{"id":"1", "title":"aaa"}, {"id":"2", "title":"bbb"}]
I tried to use a foreach method to use this data:
$.each(data, function (y, z) {
console.log(y);
console.log(z);
});
y returns a number starting at 1 and keeps counting up and z is each character in the data :( This is not what I was expecting. What do I have to get run a foreach and use each item at a time.