I get this error when I am trying to iterate through my JSON object with a foreach. Can someone help, please?
Here is my JS:
function dateTimeChecker() {
$.ajax({
"url": 'get-booked.php',
"method": "get",
"dataType": "text",
"cache": false
}).done(function(jBooked) {
var jBookedDates=JSON.parse(jBooked);
console.log(jBookedDates);
jBookedDates.forEach(function(jB){
if (jB=="11/01/2016") {console.log("works");}else{console.log("doesn't");}
})
});
}
And here is the object in question :
Also, I am wondering how can i iterate over this object if someone cares to explain. :)