同步Javascript和PHP

I have to build an online application that shows a table with content being synchronized. That means, if the content of a table cell is being changed, every user has to receive the new content without reloading the site. A time delay of a couple of seconds means no problem.

The site is running as PHP content management system. There will be not more than 10 users at same time.

How would you do that? Using JS server-sent events? Interval of AJAX requests?

This is what websockets are all about - but if you need to support older browsers then have a look at comet.

On your server, you would have some code to build the table and deliver it as HTML.

Your webpage has a div element with dynamical content. You could do an AJAX request every 1 second to call the above mentioned PHP script, take its output and fill the div with its content.

You could do it with AJAX polling, with refreshing the page using a meta tag inside your HTML document with <meta http-equiv="refresh" content="5"> (content is the time in seconds) or with something more sophisticated like Socket.IO.