if have following text updates in 2 browsers normally:
index.php send
function getstatus() { $.post('update.php', function(data) { $('div.text_window').html(data); }); settimeout("getstatus()",1000); } getstatus(); update.php
echo 'some text'; but if cancel automatic call function on page load, , assign happen when button clicked (the following code), updates in browser clicked, how make update in other browser well?
$('#send_btn').click(function() { getstatus(); });
it seems issue related availability of jquery, put initial call function in callback
$(document).ready(function() { getstatus(); }); also make sure increase timeout, should 5-10 seconds
if want instant updates , want efficiently, need use pubsub or websockets
Comments
Post a Comment