WEB how does AJAX work?

Discussion in 'OT Technology' started by babygodzilla, Sep 7, 2007.

  1. babygodzilla

    babygodzilla I love rice

    Joined:
    Nov 5, 2001
    Messages:
    3,108
    Likes Received:
    0
    can someone please tell me in 5 sentences or less how AJAX work? and what the heck does "asynchronously" exactly means?
     
  2. Nakon

    Nakon Guest

    Ajax, or AJAX, is a web development technique used for creating interactive web applications. The intent is to make web pages feel more responsive by exchanging small amounts of data with the server behind the scenes, so that the entire web page does not have to be reloaded each time the user requests a change. This is intended to increase the web page's interactivity, speed, functionality, and usability.
     
  3. pkr

    pkr Guest

    I love me some Ajax.
     
  4. hurleyint1386

    hurleyint1386 Someone has sand in their vagina

    Joined:
    Jan 6, 2005
    Messages:
    3,687
    Likes Received:
    0
    Location:
    Rochester, NY
    I really want to learn, but don't know where to start. Does anyone know what site would be perfect for it? Also, what languages are good to write with it? Some have told me PHP, some have said Python. I don't know too much on the topic, but really want to learn.
     
  5. babygodzilla

    babygodzilla I love rice

    Joined:
    Nov 5, 2001
    Messages:
    3,108
    Likes Received:
    0
    ok so that is the definition of AJAX. but how does Ajax WORK? where does the XML come into play. i know there's an XmlHTTPRequest Javascript object that is the basis of all that is AJAX, but what in holy hell does that do? and how? and what does the "Asynchronous" in AJAX mean?
     
  6. c.a

    c.a New Member

    Joined:
    Jan 24, 2006
    Messages:
    1,117
    Likes Received:
    0
    I'd like to see some replies on this because I'm interested too
     
  7. MrBrotato

    MrBrotato New Member

    Joined:
    Sep 7, 2005
    Messages:
    5,558
    Likes Received:
    0
    The definition means two way communication with a delay, so I'd guess that in this instance it refers to the ability to load a page without all the information present, and then the user clicks on something that loads more of the page later.
     
  8. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,918
    Likes Received:
    10
    Location:
    Los Angeles
    When developing AJAX applications, people usually utilize some type of framework or engine to manage the data transfered between the browser and server. This engine is responsible for the translation of the data you're attempting to process. The serverside scripting language, we'll just say PHP, is responsible for processing the data.

    JavaScript is mostly responsible for the functionality of any AJAX driven application. Any data that you'd like to process is called via any custom JavaScript functions and sent to the engine. The soul of the AJAX engine is utilizing XMLHttpRequest. XMLHttpRequest is responsible for sending and receiving data FROM and TO the server, which then you can utilize PHP to process that data or retrieve it from the database. I couldn't tell you too much about the XMLHttpRequest object but I assume it has something to do with mapping data using XML.

    You have your browser, which is responsible for all your JavaScript calls, your HTML, and your CSS. Your markup, what people see, what the browser parses.

    You parse the data you want to process through JavaScript calls, which is sent to the AJAX Engine, the AJAX Engine then sends the data to the server for processing. At this point PHP will be able to access these variables and you'll be able to process them however you'd like. Here's a simple diagram:

    js/html/css ---> XMLHttpRequest ---> php/mysql
    js/html/css <--- XMLHttpRequest <--- php/mysql

    Hope that helped.
     
  9. projectalpha

    projectalpha 二號 Stunna

    Joined:
    Aug 4, 2001
    Messages:
    17,671
    Likes Received:
    0
    Location:
    Bay Area, California
    Ajax blog: www.ajaxian.com
    Ajax forums/tutorials: www.ajaxfreaks.com

    I usually use PHP with it.
     
  10. Blizzard

    Blizzard needs to robusto

    Joined:
    Nov 9, 2004
    Messages:
    11,485
    Likes Received:
    0
    Location:
    New York City
    when you click something if fires javascript code that send a request to teh webserver, gets data back, and updates the website through javascript.

    that is probably as simple as you can describe it.
     
  11. copiertalk

    copiertalk Secure Our Borders! OT Supporter

    Joined:
    Sep 21, 2003
    Messages:
    5,695
    Likes Received:
    0
    Location:
    west texas
    vbulletin is going the way of ajax. I see alot more Ajax with the latest version than I did with 3.5.x or 3.4.x.
     
  12. Blizzard

    Blizzard needs to robusto

    Joined:
    Nov 9, 2004
    Messages:
    11,485
    Likes Received:
    0
    Location:
    New York City
    ajax is just an example where web is heading, which is interactive dynamic pages where you dont need to send a full page request just to view something.

    basically software, just online
     
  13. babygodzilla

    babygodzilla I love rice

    Joined:
    Nov 5, 2001
    Messages:
    3,108
    Likes Received:
    0
    hmmm.. thanks for the replies, but im not sure im satisfied. i think everyone said some parts of the true answer, i just need to connect the dots. rite now if someone asks me, and someone did ask me as part of an interview, "do you know how AJAX works?" i would probably say something incoherent that takes 30 sentences as oppose to a concrete solid answer that takes like 5 sentences.


    so i guess what ive got so far is that AJAX receives and sends data through Javascript, as oppose to.... what? how does a non-AJAX page send and receive data usually?
     
  14. Blizzard

    Blizzard needs to robusto

    Joined:
    Nov 9, 2004
    Messages:
    11,485
    Likes Received:
    0
    Location:
    New York City
    dude if you dont know how to use google to answer this question you will fail.
     
  15. babygodzilla

    babygodzilla I love rice

    Joined:
    Nov 5, 2001
    Messages:
    3,108
    Likes Received:
    0
    :ugh: ok asshat. thanks for helping
     
  16. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,918
    Likes Received:
    10
    Location:
    Los Angeles
    Anymore information provided, other than what's been posted, would be code.
     
  17. Tk

    Tk Well-Known Member

    Joined:
    Dec 23, 2001
    Messages:
    23,079
    Likes Received:
    281
    Location:
    nw iowa
    non-ajax pages will reload the entire page to display the updated content after the user has pressed the 'submit' button (simple example, when you will reply to one of these posts, the whole page clears and the page is reloaded from start to finish)

    with ajax enabled pages, after you hit that submit button when you reply to a post, your reply would almost immediately be added to the end of the list without seeing the page clear and then reload with that updated content you had submitted.
     
  18. Tk

    Tk Well-Known Member

    Joined:
    Dec 23, 2001
    Messages:
    23,079
    Likes Received:
    281
    Location:
    nw iowa
    if you're interested in some eBooks shoot me a PM
     
  19. bigmick

    bigmick The plane takes off OT Supporter

    Joined:
    Jan 20, 2004
    Messages:
    4,831
    Likes Received:
    0
    Location:
    Sydney AU
    LMAO no one is going to hire you.
     
  20. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,918
    Likes Received:
    10
    Location:
    Los Angeles
    :ugh:
     
  21. mobbarley

    mobbarley Active Member

    Joined:
    Mar 4, 2005
    Messages:
    9,256
    Likes Received:
    2
    Location:
    Sydney
    Ajax is a play by Sophocles, written in approximately 440 BC. It chronicles the fate of the warrior Ajax the Great after the events of the Iliad and the Trojan War. At the onset of the play, Ajax has returned to Greece and is enraged because Achilles' armor was awarded to Odysseus, rather than him. He vows to kill the Greek leaders who disgraced him. Before he can enact his revenge, though, he is tricked by the goddess Athena into believing the Greek kings are a nearby herd of cattle.
     
  22. enfiniti

    enfiniti How firm thy friendship ... OHIO!

    Joined:
    Sep 12, 2006
    Messages:
    4,813
    Likes Received:
    0
    Location:
    Columbus
    did you just read the IEEE article about it?
     
  23. El Scorcho

    El Scorcho you're never anything I rely upon

    Joined:
    May 5, 2000
    Messages:
    4,273
    Likes Received:
    0
    Location:
    LA, So. Cal
    the thing i find annoying about ajax sites is the slight delay you get when you first load it and in between actions/clicks...but i guess that unavoidable. :hsugh:
     
  24. bonarparte

    bonarparte beeeeh

    Joined:
    Sep 12, 2005
    Messages:
    32,812
    Likes Received:
    0
    Location:
    Baltimore, MD
    ajax if it requests data from server, otherwise, no ajax
     
  25. JohnJohnJohnson

    JohnJohnJohnson Effetely Sipping My Latte OT Supporter

    Joined:
    Sep 8, 2004
    Messages:
    23,006
    Likes Received:
    0
    Location:
    Manhattan
    OP:

    1. Let's make sure we agree on what AJAX is before discussing how it works.

    AJAX is a technology that allows web browsers to receive OR send fresh data without leaving the current web page. Abstractly, that means increased interactiveness. Concretely, that means you can send new posts to an off topic thread without reloading the entire thread, and receive hints when searching for users so that typing "JohnJohnJohns" will automatically complete to "JohnJohnJohnson", and get news feeds on netvibes.com updating themselves without reloading the entire page and without you even doing anything to make them update.

    How AJAX works, in five sentences. (Four and a punch line.)

    2. Clients (browsers) communicate to and from web servers using a protocol called "HTTP". Traditionally this communication occurred during page-refreshes. However, JavaScript now offers an XMLHttpRequest object that uses this HTTP protocol to send/retrieve text and XML to/from the server. Unlike the browser's page-refresh, the XMLHttpRequest object's communication does not affect a user's experience. That is how AJAX does what it does.
     

Share This Page