A simple Comet Example using AJAX (with jQuery) and PHP
To make it work, run comet.php in your browser. It'll launch the comet to ajax.php.
When you'll want to check server side events, just write something into data.txt and save it. If everything works as should, you'll see an alert box with the string you wrote into data.txt