I am trying to parse an associated array returned from a PHP functoin like this:
$.ajax({
type: "GET",
url: "../controllers/Checkpoint.php/getAllCheckpoints"
}).done(function( result ) {
result.foreach(function(index, value){
alert(index + " "+ value);
});
}).error(function(){
});
i return the array like this in php
foreach($result as $row) {
$checkpoints[$row['ID']] = $row['Name'];
}
return json_encode($checkpoints);
the result of that array reading from the chrome F12 console is
{"1":"check point 1","2":"check point 2"}
I got this error in the javascript code:
ReferenceError: forEach is not defined
could you help me please