Ajax long polling

I recently asked a question about StackOverflow about my feature, and people recommended using Ajax Long Polling. I spent the last couple of days studying the subject and tried to write a basic long survey code, but none of them worked, and I can’t get anything that I do to work at all.

Here is my main function:

    <script language='javascript' type='text/javascript'>
    var interval=self.setInterval("checkformessages()",4000)
    function checkformessages() {
    $('#incomingmessages<?php echo $otherchatuser ?>').load('checkfornewmessages.php?username=<?php echo $username; ?>&otherchatuser=<?php echo $otherchatuser; ?>');
    }
    </script>

Someone can tell me how to turn this into a basic long polling function, or even just direct the path I need. Any help is greatly appreciated. Thank!

+3
source share
1 answer

(.. ) JavaScript , . - . (, , ) , , , , checkfornewmessages.php. , JavaScript , , , " ".

, checkfornewmessages.php " ", checkfornewmessages.php, - .

, , , checkfornewmessages.php. javascript , checkfornewmessages.php .

+6

All Articles