Open chaos67731 opened 7 years ago
@chaos67731 You may want to consider just using a meta refresh and skip js:
<meta http-equiv="refresh" content="30" />
Using this will cause your page to pick up any updates you've pushed to the server. I'm taking this approach on a project I'm currently working on.
@chaos67731 Create a new gcall-data.php page and put there:
<?php echo '<ul id="events-upcoming"></ul>'; ?>
<script>
formatGoogleCalendar.init({
.
.
your options
.
.
});
console.log("gCall Fire");
</script>
After that create a div element where you want to show the gCall. Something like this:
<div id="loadgcall"></div>
and call it with this script:
<script>
$(document).ready(function($) {
$('#loadgcall').load('gcall-data.php');
});
$(function(){
setInterval(function(){
var h = $('#loadgcall').parent().height();
$("#loadgcall").load('gcall-data.php');
$('#loadgcall').parent().height(h);
}, 300000);
});
</script>
Change the time to everything you want and you will see the gCall update every x seconds.
I have tested and works perfect.
Hope that helps.
It would be nice to have a way to get the calendar to auto update.
In the project I have going on, I have used the following code.... but I feel there has to be a better way? You will notice I have had to run
$( "#events-upcoming" ).empty();
to get the list items to be rebuilt.