Reputation: 1113
I have two working functions. How to run $.getJSON(..) every minute inside window.setInterval?
<script>
window.setInterval(function(){
functionCall(); // ??
}, 60000);
</script>
<script>
$(document).ready(function() {
var query = "SELECT * FROM schedule;";
$.getJSON(
'modules/mod_scheduler/updateList.php?query='+query,
function(data)
{
createChartControl('schedule', data);
}
);
});
</script>
Upvotes: 1
Views: 1863
Reputation: 187074
<script>
window.setInterval(function(){
var query = "SELECT * FROM schedule;";
$.getJSON(
'modules/mod_scheduler/updateList.php?query='+query,
function(data)
{
createChartControl('schedule', data);
}
);
}, 60000);
</script>
Though I feel compelled to add that passing SQL from your website frontend directly to your database is very very bad idea. A hacker get literally do anything they wanted with your database, from accessing private data to deleting your whole universe.
Upvotes: 3