¡@

Home 

php Programming Glossary: waitformsg

long-polling info from mysql not working

http://stackoverflow.com/questions/11453423/long-polling-info-from-mysql-not-working

charset utf 8 var old_msg_id php echo old_msg_id function waitForMsg .ajax type GET url poll.php old_msg_id old_msg_id async true.. msg added to base old_msg_id json 'old_msg_id' setTimeout 'waitForMsg ' 1000 error function XMLHttpRequest textStatus errorThrown.. errorThrown alert error textStatus errorThrown setTimeout 'waitForMsg ' 15000 document .ready function waitForMsg function load old_msg_id..

Simple “Long Polling” example code?

http://stackoverflow.com/questions/333664/simple-long-polling-example-code

to the #messages div then after 1 second we call the waitForMsg function again which triggers the wait. The 1 second setTimeout.. #messages .append div class 'msg type ' msg div function waitForMsg This requests the url msgsrv.php When it complete or errors.. Add response to a .msg div with the new class setTimeout waitForMsg Request next message 1000 ..after 1 seconds error function..