I know similar questions are raised many times, as I can see in the search. But I could not manage the refresh work in PHP for the list I'm using.
Refreshing the datetime was an easy test, which works. When switching to complex function, it doesnt. And this is confusing me. Hope you can tell me what I'm doing wrong.
Currently I'm preparing a page which loads X amount of locations and its reservations. Each second I want the locations and their total counts being refreshed.
Currently my code:
DIV, containing a PHP functions that launches a MySQL query, lists the data to HTML format/layout:
echo ' <div id="location">
<div id="session">
'.listLocationToBook($current_user_id, $filter_city, $date, $token, $url).'
</div>
</div>';
Script
<script type="text/javascript">
setInterval("my_function();",3000);
function my_function(){
$('#location').load(location.href + ' #session');
}
</script>
When I put a timer (datetime) in stead of the PHP functions in the div, I see the time increasing with the 3 secs.
Any reason this is not working with the PHP function? How can I solve/work towards an alternative?
Thanks in advance