I am trying to display a dynamic dropdown menu that withdraws data from mysql, but having trouble with referencing my php function inside javascript.
Here is my php function:
function query(){
$myData = mysqli_query(dbconnect1(), "select time from time");
while($record = mysqli_fetch_array($myData)){
echo '<option value="' . $record['time'] . ' ">' .$record['time'] . '"</option>';
}
}
And here is the js where I want to reference it:
var $modal = $( '<div class="rm-modal"><div class="rm-thumb" <h5>' + title + '</h5><span class="rm-close-modal">x</span></div>' );
The problem is, I cannot reference the php query in there.
I know it is a problem referencing php inside javascript, but could someone come up with alternative solution which is easy to understand (since I'm a newbie)?