javascript - Refresh 2 divs with 1 ajax request -
javascript - Refresh 2 divs with 1 ajax request -
this question has reply here:
jquery multiple load in div 6 answerssay have 2 divs, how can refresh them both every 5 seconds 1 ajax request?
<div id='1'></div> <div id='2'></div>
i can refresh 1 this:
interval = settimeout(refreshpage, 5000); function refreshpage() { $('#1').load('page.php?&timer='+new date().gettime()+' #1'); interval = settimeout(refreshpage, 5000); }
so, assuming want same ajax phone call populate 2 different div's this:
here's html:
<div id='1'></div> <div id='2'></div>
so, can ajax request individually , load same request 2 divs:
interval = settimeout(refreshpage, 5000); function refreshpage() { var info = $.get('page.php?&timer='+new date().gettime()+' #1').done(function (response) { ('#1').html(response); ('#2').html(response); }); interval = settimeout(refreshpage, 5000); }
javascript php jquery ajax intervals
Comments
Post a Comment