SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2008
    0 Post(s)
    0 Thread(s)

    how does it works?

    hi there

    On the stackoverflow, there is a add comment functionality, which is done using ajax. I'm curious to know how that works. I understand that on add comment button, a ajax post request is sent to the server, but from his point I'm stuck.

    Can u explain me how it works or send me to some web resuorces which explains it?

  2. #2
    Barefoot on the Moon! silver trophy Force Flow's Avatar
    Join Date
    Jul 2003
    Northeastern USA
    56 Post(s)
    1 Thread(s)
    After clicking submit, the javascript does two things:

    1) Sends the data back to the server via AJAX to be stored in the database and returns an "okay" back to the browser if the comment is successfully added/stored.
    2) When the browser gets the "okay" response from the server via AJAX, another javascript function appends the data/text/comment to the existing HTML without having to reload the entire page. If the browser does not get the "okay", the user may see an error message displayed instead.
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts