After struggling for a day, I finally managed to get some output from PHP instead of just the word "array". What a relief!
(check out this link for the solution)
Basically, this is the data returned from an XMLHTTP request to PHP, handled through a JS callback. I used print_r
in PHP to retrieve it.
I've included a snippet of the results below. Now, my new question is:
- what exactly makes up this data structure?
how can I extract elements like CourseID (in JS) from this structure?
[0] => Parse\ParseObject Object ( [serverData:protected] => Array ( [CourseID] => DEMO2 [EndDate] => DateTime Object ( [date] => 2017-03-31 10:26:00.000000 [timezone_type] => 2 [timezone] => Z ) [InfoTitle1] => Welcome [InfoText1] => Welcome to your course, called "sense & sales". [Admin] => Remco@Demo1 )
This is the PHP code I'm using:
function getGroups(){
$query = new ParseQuery("CourseInfo");
$query->equalTo("Admin", "Remco@Demo1");
$results = $query->find();
// echo $results // this lead to the string "array"
//print_r($results); // this leads to the complicated array
//echo "<script>\r\n var phpOutput = " . json_encode($results) . ";\r\n console.log(phpOutput);\r\n</script>";
// this leads to [{},{}];
}