Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
Thread: Ajax add to pre-existing array?
08-19-2011, 08:11 AM #1
- Join Date
- Nov 2004
- Thanked 0 Times in 0 Posts
Ajax add to pre-existing array?
I've been meaning to learn the answer to this question for a long time, I guess now is the time and place to hopefully have it answered.
I'm wanting to know if there is a technique one can use to have Ajax request live data from a database as it happens but I want it to do this with out having to request a bunch of other information with it.
Imagine you come to a webpage and there is the latest 10 comments on a video. Let's say that I want new comments to arrive as they happen (say every 5 seconds we will do an Ajax hit on the server). Let's say for sake of argument there is 2 new comments. Is there a way to make Ajax only request and display the latest 2 comments with out having to refresh the 10 latest as well?
If this sounds confusing, try imagine the 10 comments as an array. I just want to pop one off the end and push a new one onto the front.
Any tips in the right direction would be great to hear.