So, I\'ve been trying to do Long-Polling using the jQuery Library and PHP. I\'m doing this so I can make some sort of real-time notifications system in the future. The code
Try to use this for ajax.php
<?php if(rand(1, 100) % 2) { echo 'even<br />'; } else { sleep(rand(8, 12)); } ?>
watch this and sometimes you have to wait up to 12 seconds
if you let him to complete in one second it appears to be broken, but it's not