Finally i get some output out of PHP instead of just the word "array". This took me a day, AAAAHHHH.
(see here for the solution)
So this is the return value from a XMLHTTP request (to PHP), via a callback in JS. I got it with print_r
in PHP.
I post a snippet of the results here.
My new question:
- what is this data structure made of?
how to get elements out of this structure, such as CourseID (in JS)?
[0] => ParseParseObject 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
)
My PHP code is
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>
var phpOutput = " . json_encode($results) . ";
console.log(phpOutput);
</script>";
// this leads to [{},{}];
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…