$(document).ready(function () {
$(function () {
var timer,updateContent;function resetTimer() {
if (timer) { window.clearTimeout(timer); } timer = window.setTimeout(updateContent, 20000); } updateContent = function () { resetTimer(); fetchdata(); }; resetTimer(); }); });function fetchdata(){ $.ajax({ url: 'fetch_details.php', type: 'post', success: function(response){ // Perform operation on the return value alert(response); } }); }
OR
function fetchdata(){ $.ajax({ url: 'fetch_details.php', type: 'post', success: function(response){ // Perform operation on the return value alert(response); } }); } $(document).ready(function(){ setInterval(fetchdata,5000); });
0 comments:
Post a Comment