I'm trying to update content in an active loaded page using webhook response.
Earlier, I used to trigger the function using setTimeout for every 5 secs but noticed its kind of increasing server load. So, now whenever there is a change on the database a webhook will be triggered through which I will update the content on the loaded page without refreshing it.
But how do I tell a webhook URL to change/update content on another page.?
so far code goes as : PAGE#1:
<div id="loader_div">Some content</div>
<script>
function loadlink(){
$('#loader_div').load('loading.php',function () {
$(this).unwrap();
});
}
loadlink(); // This will run on page load
setInterval(function(){
loadlink()
}, 5000); // this will run after every 5 seconds
</script>
loading.php
<p>some other content that i got from database</p>
Now the webhook URL is loading.php which gets the new update from the database, but how do I trigger the 'loadlink();' on the page1 without refreshing it and using set timeout..?