JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 19th, 2012, 04:23 AM
Lenton Lenton is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2012
Posts: 10 Lenton User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 45 m 27 sec
Reputation Power: 0
AJAX Shoutbox Help

I'm currently creating an AJAX shoutbox using JavaScript and PHP. I was wondering what's the best way to build it.

I was thinking of storing a last shout ID in JavaScript and use it in the AJAX request to the PHP file:

shoutbox.php?last=21

If it is the last message then the PHP file would output nothing.
Otherwise if there were 23 shouts stored on the server for example, it would output the following XML:

xml Code:
Original - xml Code
  1. <newshouts>
  2.   <shout>
  3.     <author>Bob</author>
  4.     <message>Hello.</message>
  5.   </shout>
  6.   <shout>
  7.     <author>Steve</author>
  8.     <message>Sup.</message>
  9.   </shout>
  10. </newshouts>


Then in the JavaScript I would need to retrieve this data and add it to the shoutbox.
I would also need to remove the oldest two messages in the shoutbox because I want a certain number of shouts in the shoutbox at once.

Is this a good way to do it or is there a better/more efficient way of doing it?

If this is a good way I would like some help on writing the JavaScript code for it, especially removing the old messages from the shoutbox after adding new ones.

Thanks so much for you help.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > AJAX Shoutbox Help

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap