Search code examples
phpjavascriptmysqlajaxlive

Live AJAX content


My friend and I maintain a submission site with comments. We want to know if it is possible to have a constant AJAX connection. Basically, each submission has a comments section. My friend had an idea of having an alert appear on the page everytime a new comment came in. So, would it be possible to keep up a constant link between the AJAX object and a PHP script that queries the comment database? If so, how? If not, is there another way to do it?


Solution

  • Sounds like you are describing Comet.

    Alternatively, most sites that do that kind of thing just make a query to the server every so often asking if anything new has been posted (need to make sure you pass in a timestamp of the last time you checked).