Skip to Main Content

how does facebook comments work? I mean if i have to do in j2ee.

Murray9654Feb 6 2013 — edited Feb 8 2013
For example on facebook when we post a comment, it appears right next to the earlier comment immediately. how does this happen? I don't think the entire page is reloading. I even don't think part of the page is refreshed. Is it Ajax? If so what are the steps involved in achieving this? If not Ajax, what is it and how is it being done?

one way to do this is
write a comment and submit. when submit make an ajax call to the server. On the server capture the param and store it into the database. After storing in the database retrieve the stored messages based on the time stamp and send them as response. one the client (browser) receives the response as HTML, add this HTML is appended next to the recent message.

I feel this is good but is there a better way than this?
Post Details
Added on Feb 6 2013