AllExperts > Encyclopedia 
Search      
Find out about volunteering to AllExperts

Ajax (programming): Encyclopedia BETA


Free Encyclopedia
 Home · Index · Browse A-Z  · Questions and Answers ·
Encyclopedia

Browse A-Z
ABCDEFGHIJKLMNOPQRSTUVWXYZNum


License
Disclaimer

 
 
 
 
Free Online Courses
12 Weeks to Weight Loss
Take Charge of Stress
Learn How to Bake
Budgeting 101
Deeper Faith
DIY Fashion Makeover

       MORE E-COURSES
 
   

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z  Misc

Ajax (programming)

"AJAX" redirects here. For other uses, see Ajax (disambiguation).Ajax, shorthand for Asynchronous JavaScript and XML, is a web development technique 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 makes a change. This is meant to increase the web page's interactivity, speed, and usability.

The Ajax technique uses a combination of:
* XHTML (or HTML) and CSS, for marking up and styling information.
* The DOM accessed with a client-side scripting language, especially ECMAScript implementations such as JavaScript and JScript, to dynamically display and interact with the information presented.
* The XMLHttpRequest object to exchange data asynchronously with the web server. In some Ajax frameworks and in certain situations, an IFrame object is used instead of the XMLHttpRequest object to exchange data with the web server.And optionally:
* XML is sometimes used as the format for transferring data between the server and client, although any format will work, including preformatted HTML, plain text, JSON and even EBML. These files may be created dynamically by some form of server-side scripting.
* SOAP is a protocol for exchanging XML-based messages over a computer network, normally using HTTP. SOAP forms the foundation layer of the Web services stack, providing a basic messaging framework that more abstract layers can build on.Like DHTML, LAMP and SPA, Ajax is not a technology in itself, but a term that refers to the use of a group of technologies together.

History

The first use of the term in public was by Jesse James Garrett in February 2005{{cite web
url=http://www.adaptivepath.com/publications/essays/archives/000385.phptitle=Ajax: A New Approach to Web Applicationspublisher=Adaptive Pathdate=2005-02-18accessdate=2006-08-01. Garrett thought of the term while in the shower{{cite weburl=http://online.wsj.com/public/article/SB113098635587487074-3diFzslPm_iutdYLU2C5e4DinUA_20061103.htmltitle=New Web-based Technology Draws Applications, Investorspublisher=Wall Street Journaldate=2005-11-03accessdate=2006-06-14, when he realized the need for a shorthand term to represent the suite of technologies he was proposing to a clientAt subsequent talks and seminars Garrett has made the point that Ajax is not an acronym..

Although the term "Ajax" was coined in 2005, most histories of the technologies that enable Ajax start a decade earlier with Microsoft's initiatives in developing Remote Scripting. Techniques for the asynchronous loading of content on an existing web page without requiring a full reload date back as far as the IFRAME element type (introduced in Internet Explorer 3 in 1996) and the LAYER element type (introduced in Netscape 4 in 1997, abandoned during early development of Mozilla). Both element types had a src attribute that could take any external URL, and by loading a page containing JavaScript that manipulated the parent page, Ajax-like effects could be attained. This set of client-side technologies was usually grouped together under the generic term of DHTML. Macromedia's Flash could also, from version 4, load XML and CSV files from a remote server without requiring a browser refresh.

Microsoft's Remote Scripting (or MSRS, introduced in 1998) acted as a more elegant replacement for these techniques, with data being pulled in by a Java applet with which the client side could communicate using JavaScript. This technique worked on both Internet Explorer version 4 and Netscape Navigator version 4 onwards. Microsoft then created the XMLHttpRequest object in Internet Explorer version 5 and first took advantage of these techniques using XmlHttpRequest in Outlook Web Access supplied with the Microsoft Exchange Server 2000 release.

The Web development community, first collaborating via the microsoft.public.scripting.remote newsgroup and later through blog aggregation, subsequently developed a range of techniques for remote scripting in order to enable consistent results across different browsers. In 2002, a user-community modification{{cite web
url=http://groups.google.ca/group/microsoft.public.scripting.remote/browse_thread/thread/99b7e6152b45b2e7/6b3689e2dc7401dctitle=HTTPRequest-enabled RSpublisher=microsoft.public.scripting.remote newsgroupdate=2002-06-18accessdate=2006-08-01 to Microsoft Remote Scripting was made to replace the Java applet with XMLHttpRequest.

Remote Scripting Frameworks such as ARSCIF{{cite web
url=http://arscif.dsi.unimi.it/title=ARSCIF: A Framework for Asynchronous Remoteâ€"Script Callback Invocationpublisher=Sebastiano Vignaaccessdate=2006-08-01 surfaced in 2003 not long before Microsoft introduced Callbacks in ASP.NET{{cite weburl=http://msdn.microsoft.com/msdnmag/issues/04/08/CuttingEdge/title=Cutting Edge: Script Callbacks in ASP.NETpublisher=MSDN Magazinedate=2004-08-08accessdate=2006-08-01.

Since XMLHttpRequest is now implemented across the majority of browsers in use, alternative techniques are used infrequently. However, they are still used where compatibility with older Web sites or legacy applications is required.

Pros and cons

Pros

Bandwidth utilization

By generating the HTML locally within the browser, and only bringing down JavaScript calls and the actual data, Ajax web pages can appear to load quickly since the payload coming down is much smaller in size. An example of this technique is a large result set where multiple pages of data exist. With Ajax, the HTML of the page, e.g., a table control and related TD and TR tags can be produced locally in the browser and not brought down with the first page of data. If the user clicks other pages, only the data is brought down, and populated into the HTML generated in the browser.

Interactivity

Ajax applications are mainly executed on the user's machine, by manipulating the current page within their browser using document object model methods. Ajax can be used for a multitude of tasks such as updating or deleting records; expanding web forms; returning simple search queries; or editing category trees—all without the requirement to fetch a full page of HTML each time a change is made. Generally only small requests need to be sent to the server, and relatively short responses are sent back. This permits the development of more interactive applications featuring more responsive user interfaces due to the use of DHTML techniques.

While the Ajax platform is more restricted than the Java platform, current Ajax applications effectively fill part of the niche first served by Java applets: extending the browser with lightweight mini-applications.

Cons

The "wtf" factor

Currently development using Ajax will increase development time due to the 'newness' of the environment, developers infamiliarity with it, quirks within Internet Explorer (and possibly other browsers) and other integration issues.

Usability

Web applications that utilise Ajax may break the expected behavior of the browser's back button. The difference between returning to a previous state of the current, dynamically modified page versus going back to a previous static page might be a subtle one; but users generally expect that clicking the back button in web applications will move their browser to the last page it loaded, and in Ajax applications this might not be the case.

Developers have implemented various solutions to this problem. These solutions can involve using invisible IFRAMEs to invoke changes that populate the history used by a browser's back button. Google Maps, for example, performs searches in an invisible IFRAME and then pulls results back into an element on the visible web page. Although the World Wide Web Consortium (W3C) has not formally deprecated the IFRAME element which was introduced in HTML 4, the standard recommends the OBJECT tag instead.

Another issue is that dynamic web page updates make it difficult for a user to bookmark a particular state of the application. Solutions to this problem exist, many of which use the URL fragment identifier (the portion of a URL after the '#' {{cite web
url=http://www.ietf.org/rfc/rfc2396.txttitle=Uniform Resource Identifiers (URI): Generic Syntaxpublisher=The Internet Societydate=August 1998accessdate=2006-07-21 {{cite weburl=http://www.ietf.org/rfc/rfc3986.txttitle=Uniform Resource Identifier (URI): Generic Syntaxpublisher=The Internet Societydate=January 2005accessdate=2006-07-21) to keep track of, and allow users to return to, the application in a given state. This is possible because many browsers allow JavaScript to update the fragment identifier of the URL dynamically, so that Ajax applications can maintain it as the user changes the application's state. This solution also improves back-button support. It is, however, not a complete solution.

Response-time concerns

Network latency â€" or the interval between user request and server response â€" needs to be considered carefully during Ajax development. Without clear feedback to the user {{cite web
url=http://www.xml.com/pub/a/2005/08/22/ajax.htmltitle=Remote Scripting with AJAX, Part 2publisher=O'Reilly XML.comdate=2005-08-22accessdate=2006-07-21, smart preloading of data and proper handling of the XMLHttpRequest object, users might experience delay in the interface of the web application, something which users might not expect or understand. The use of visual feedback to alert the user of background activity and/or preloading of content and data are often suggested solutions to these latency issues.

In general the potential impact of latency has not been "solved" by any of the open source Ajax toolkits and frameworks available today, such as the effect of latency variance over time.

Accessibility

Using Ajax technologies in web applications provides many challenges for developers interested in adhering to WAI accessibility guidelines. In addition there are numerous development groups working on USA government projects which require strict adherence to Section 508 Compliance standards. Failure to comply with these standards can often lead to cancellation of contracts or lawsuits intended to ensure compliance.

Because of this, developers need to provide fallback options for users on other platforms or browsers, as most methods of Ajax implementation rely on features only present in desktop graphical browsers.

Web developers use Ajax in some instances to provide content only to specific portions of a web page, allowing data manipulation without incurring the cost of re-rendering the entire page in the web browser. Non-Ajax users would ideally continue to load and manipulate the whole page as a fallback, allowing the developers to preserve the experience of users in non-Ajax environments (including all relevant accessibility concerns) while giving those with capable browsers a much more responsive experience.

See also

* Ajax framework
* HTTP streaming
* Progressive enhancement
* Rich Internet application
* Single page application
* Web 2.0
* XMLHttpRequest

References

External links

Web directory
*AJAX category on the Open Directory Project.
Tutorials
* Ajax:Getting Started by Mozilla Developer Center.
* Building an Ajax page with get, post, text, XML example.



Email this page
About Us | Advertise on This Site | User Agreement | Privacy Policy | Kids' Privacy Policy | Help
About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.
This is the "GNU Free Documentation License" reference article from the English Wikipedia. All text is available under the terms of the GNU Free Documentation License. See also our Disclaimer.