RE: Quick question for PHP/JavaScript developers...
May 15, 2011 at 10:46 am
The previous shoutbox did everything via AJAX calls. You can see that code here:
http://atheistforums.org/jscripts/shoutbox.js
When the page is first loaded, the Shoutbox should make an AJAX call to some php script which returns the HTML code for the last x shouts. Then, every 30 seconds, an AJAX call is made to the php script which returns all new shouts that have been made since the last call. If no new shouts have been made, nothing happens. If new shouts have been made, then the script adds them to the top of the HTML.
When someone types a new shout, and presses "Shout" or "Submit", then the shout is sent to the php script via an AJAX call, and the php script returns all new shouts (including the one just made) since the last update.
When someone deletes a shout, an AJAX call is made to the php script, and the script removes the shout from the html.
When someone edits a shout, an AJAX call is made to the php script, which returns the raw data of that specific shout. The script then shows the user a query box, where they can edit their shout, and once the changes are made, a new AJAX call is made which updates the shout (and the PHP script returns the new updated HTML).
Or something like that. That's what the current shoutbox does (except for the deleting / editing). I just want a simpler version which is coded well, and which I can customize easily.