Search
Left Quote    I find that the harder I work, the more luck I seem to have.
- Thomas Jefferson    
Right Quote
 
[login] | [Register]
 

Getting Started with Ajax

by: misterhaan
Page: 1 of 4
(View All)

Using Ajax


Ajax is an acronym for asynchronous javascript and xml. The important part of this name is asyncronous javascript — send a request to a web server using javascript code, and wait in the background for the result to load. Once the result has loaded, it’s available to javascript to read and usually either update the current page, display an alert, or take some other action.

The “and xml” part of the name refers to the format the response data uses. In practice xml is only one of the options, which happens to have extra support built in by automatically loading xml into an object for manipulation. Depending on the specific use however it may be more appropriate to send html, tab-separated values, or just a plain-text list of options separated by line breaks.

Using ajax can save time and enhance the experience of a web site by avoiding a full page load for small tasks. If most of the page should stay the same but some additional information or analysis is required from the server, that’s probably a good candidate for ajax. Some examples are validating input without leaving the form, see Ajax guides on track7 which suggest common values for a text field[/link], or saving a forum post in the database and then adding it to the page without reloading.

If at all possible, make the feature at least minimally usable first without any javascript, then come back and enhance it with ajax. This way users who are able to run ajax get the fully enhanced experience, but those who are unable can still get done what they need to do, even if it’s not quite as convenient.


An ajax feature is implemented in three phases:
  • Sending the Request
  • Generating the Response
  • Acting on that Response

The first and last phases are handled by the javascript code from a single page, while the second phase is handled on the web server while the javascript waits. This guide goes through the phases in chronological order, which means we jump from javascript to php and then back.


1  |  2  |  3  |  4  |  
Next »


No Comments for this page.

You Must be logged in or a member to comment.


Tutorial Stats

Tutorial Stats

3,707 Views
0 Total Comments
5 Rating of 5 (1 Votes)

Options

Tutorial Options

· Login to Rate This Article
· Login to Post a Comment
· Read more by this author
Digg This Article! Del.icio.us: Bookmark This Article Reddit: Bookmark This Article BlinkList: Blink This Article! YahooMyWeb BlogMarks: Add This Mark! Furl: Save This Article Spurl: Mark This Article

Articles

Related    

· Learning JavaScript Basics
Your Article Here


"AllSyntax.com" Copyright © 2002-2012; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank