I have a largely PHP-based web app. that also uses - on one or two pages - JQuery and JQWidgets - both of which I am new to. For data access, I have a data-layer.php file containing all my PDO requests to the MySQL database. These all work perfectly with PHP.
In my data-layer.php file, at the end of this PDO SELECT function: getMembersAtActivity($PDOdbObject, $eventId, $actId), I have added a "json_encode($rows)" statement to translate my returned rows to JSON format, as required by JQWidgets.
All this works well. Now in my PHP/HTML page, I want to construct the nice JQWidget that uses this JSON-formatted data.
In PHP I can do a print_r to see that there is indeed an array (unnamed) of objects, returned by the getMembersAtActivity function. However, I don't know how to make a variable that contains this array in JQuery, which is necessary to populate a JQListbox with my JSON rows.
There are many, many posts here that show how to iterate through a JSON array, but this is not my problem. I first need to grab a reference to that array of objects, which is in a different PHP data file, and then iterate through the array so that I can build a list box with JQWidgets.
Thanks for any help you can provide!