All Topics  
Ajax (programming)

 

   Email Print
   Bookmark   Link






 

Ajax (programming)



 
 
Ajax, or AJAX (Asynchronous JavaScript
JavaScript

JavaScript is a scripting language widely used for client-side web development. It was the originating Programming language dialect of the ECMAScript standard....
 and XML), is a group of interrelated web development
Web development

Web development is a broad term for any activity related to developing a web site for the World Wide Web or an intranet. This can include e-commerce business development, web design, web content development, Client-side scripting/server-side scripting programming, and web server configuration....
 techniques used to create interactive web application
Web application

In software engineering, a web application or webapp is an Application software that is accessed via web browser over a network such as the Internet or an intranet....
s or rich Internet application
Rich Internet application

Rich Internet applications are web applications that have some of the characteristics of Application software, typically delivered by way of an Ajax framework, Proprietary software web browser Plug-in s, advanced javascript compiler technology, or independently via Sandbox es or virtual machines....
s. With Ajax, web application
Web application

In software engineering, a web application or webapp is an Application software that is accessed via web browser over a network such as the Internet or an intranet....
s can retrieve data from the server
Web server

The term web server can mean one of two things:# A computer program that is responsible for accepting Hypertext Transfer Protocol requests from clients , and Server them HTTP responses along with optional data contents, which usually are web pages such as Hypertext Markup Language documents and linked objects ....
 asynchronously
Asynchronous I/O

Asynchronous I/O, or non-blocking I/O, is a form of input/output processing that permits other processing to continue before the transmission has finished....
 in the background without interfering with the display and behavior of the existing page. The use of Ajax has led to an increase in interactive animation on web pages. Data is retrieved using the XMLHttpRequest
XMLHttpRequest

XMLHttpRequest is a Document Object Model Application programming interface that can be used inside a web browser scripting language, such as Javascript, to send an Hypertext Transfer Protocol directly to a web server and load the Response data directly back into the scripting language....
 object
Object (computer science)

In its simplest embodiment, an object is an allocated region of storage. Since programming languages use variable#Computer_programmings to access objects, the terms object and variable are often used interchangeably....
 or through the use of Remote Scripting
Remote Scripting

Remote Scripting is a technology which allows scripts running inside a browser to exchange information with a server. The local scripts can invoke scripts on the remote side and process the returned information....
 in browsers that do not support it.






Discussion
Ask a question about 'Ajax (programming)'
Start a new discussion about 'Ajax (programming)'
Answer questions from other users
Full Discussion Forum



Encyclopedia


Ajax, or AJAX (Asynchronous JavaScript
JavaScript

JavaScript is a scripting language widely used for client-side web development. It was the originating Programming language dialect of the ECMAScript standard....
 and XML), is a group of interrelated web development
Web development

Web development is a broad term for any activity related to developing a web site for the World Wide Web or an intranet. This can include e-commerce business development, web design, web content development, Client-side scripting/server-side scripting programming, and web server configuration....
 techniques used to create interactive web application
Web application

In software engineering, a web application or webapp is an Application software that is accessed via web browser over a network such as the Internet or an intranet....
s or rich Internet application
Rich Internet application

Rich Internet applications are web applications that have some of the characteristics of Application software, typically delivered by way of an Ajax framework, Proprietary software web browser Plug-in s, advanced javascript compiler technology, or independently via Sandbox es or virtual machines....
s. With Ajax, web application
Web application

In software engineering, a web application or webapp is an Application software that is accessed via web browser over a network such as the Internet or an intranet....
s can retrieve data from the server
Web server

The term web server can mean one of two things:# A computer program that is responsible for accepting Hypertext Transfer Protocol requests from clients , and Server them HTTP responses along with optional data contents, which usually are web pages such as Hypertext Markup Language documents and linked objects ....
 asynchronously
Asynchronous I/O

Asynchronous I/O, or non-blocking I/O, is a form of input/output processing that permits other processing to continue before the transmission has finished....
 in the background without interfering with the display and behavior of the existing page. The use of Ajax has led to an increase in interactive animation on web pages. Data is retrieved using the XMLHttpRequest
XMLHttpRequest

XMLHttpRequest is a Document Object Model Application programming interface that can be used inside a web browser scripting language, such as Javascript, to send an Hypertext Transfer Protocol directly to a web server and load the Response data directly back into the scripting language....
 object
Object (computer science)

In its simplest embodiment, an object is an allocated region of storage. Since programming languages use variable#Computer_programmings to access objects, the terms object and variable are often used interchangeably....
 or through the use of Remote Scripting
Remote Scripting

Remote Scripting is a technology which allows scripts running inside a browser to exchange information with a server. The local scripts can invoke scripts on the remote side and process the returned information....
 in browsers that do not support it. Despite the name, the use of JavaScript
JavaScript

JavaScript is a scripting language widely used for client-side web development. It was the originating Programming language dialect of the ECMAScript standard....
 and XML is not actually required, nor do the requests need to be asynchronous
Asynchrony

Asynchrony, in the general meaning, is the state of not being synchronization.* Asynchronous learning* Collaborative editing systemsIn specific terms of digital logic and physical layer of communication, an asynchronous process does not require a clock signal....
. The acronym AJAX has thus changed to the term Ajax, which does not represent these specific technologies.

History

While the term AJAX was coined in 2005, alternative techniques for the asynchronous loading of content date back to the mid 1990s. Java applet
Java applet

A Java applet is an applet delivered to the users in the form of Java bytecode. Java applets can run in a Web browser using a Java Virtual Machine , or in Sun Microsystems's AppletViewer, a stand-alone tool for testing applets....
s were introduced in the first version of the Java language in 1995. These allow compiled client-side code to load data asynchronously from the web server after a web page is loaded. In 1996, Internet Explorer
Internet Explorer

Windows Internet Explorer , commonly abbreviated to IE, is a series of graphical user interface web browsers developed by Microsoft and included as part of the Microsoft Windows line of operating systems starting in 1995....
 introduced the IFrame
IFrame

IFrame is an HTML element which makes it possible to embed an HTML document inside another HTML document.The size of the IFrame can be specified in the surrounding HTML page, so that the surrounding page can already be presented in the Web browser while the IFrame is still being loaded....
 element to HTML
HTML

HTML, an Acronym and initialism of HyperText Markup Language, is the predominant markup language for Web pages. It provides a means to describe the structure of text-based information in a document?by denoting certain text as links, headings, paragraphs, lists, and so on?and to supplement that text with interactive forms, embedded '...
, which also enables this to be achieved. In 1999, Microsoft created the XMLHttpRequest object as an ActiveX
ActiveX

ActiveX is a component Object Model developed by Microsoft for Microsoft Windows. By using the Component Object Model runtime, developers can create Component-based software engineering that perform a particular function or a set of functions....
 control in Internet Explorer 5
Internet Explorer 5

Microsoft Internet Explorer 5 is a graphical web browser released in March 1999 by Microsoft, primarily for Microsoft Windows, but initially with versions available for Apple Macintosh, Sun Microsystems Solaris , and HP-UX....
. This is now supported by Mozilla
Mozilla

Mozilla was the official, public, original name of Mozilla Application Suite by the Mozilla Foundation, currently known as SeaMonkey internet suite....
 and Safari
Safari (web browser)

Safari is a web browser developed by Apple Inc.. First released as a beta on January 7, 2003 on the company's Mac OS X operating system, it became Apple's default browser beginning with Mac OS X v10.3, commonly known as "OS X Panther." Apple has also made Safari the native browser for the iPhone OS....
 as native versions of the object. On April 5, 2006 the World Wide Web Consortium
World Wide Web Consortium

The World Wide Web Consortium is the main international standards organization for the World Wide Web . It is arranged as a consortium where member organizations maintain full-time staff for the purpose of working together in the development of standards for the World Wide Web....
 (W3C) released the first draft specification for the object in an attempt to create an official web standard.

Technologies

The term Ajax has come to represent a broad group of web technologies that can be used to implement a web application that communicates with a server in the background, without interfering with the current state of the page. In the article that coined the term Ajax, Jesse James Garrett
Jesse James Garrett

Jesse James Garrett is an experience designer, known for having coined the term Ajax .Jesse is the founder of Adaptive Path, a user experience strategy and design firm, and co-founded the Information Architecture Institute....
 explained that the following technologies are required:
  • XHTML
    XHTML

    The Extensible Hypertext Markup Language, or XHTML, is a markup language that has the same depth of expression as HTML, but also conforms to XML syntax....
     and CSS
    CSS

    CSS may stand for:...
     for presentation
  • the Document Object Model
    Document Object Model

    The Document Object Model is a platform- and programming language-independent standard object model for representing HTML or XML documents as well as an Application Programming Interface for querying, traversing and manipulating such documents....
     for dynamic display of and interaction with data
  • XML and XSLT for the interchange, manipulation and display of data, respectively
  • the XMLHttpRequest
    XMLHttpRequest

    XMLHttpRequest is a Document Object Model Application programming interface that can be used inside a web browser scripting language, such as Javascript, to send an Hypertext Transfer Protocol directly to a web server and load the Response data directly back into the scripting language....
     object for asynchronous communication
  • JavaScript
    JavaScript

    JavaScript is a scripting language widely used for client-side web development. It was the originating Programming language dialect of the ECMAScript standard....
     to bring these technologies together


Since then, however, there have been a number of developments in the technologies used in an Ajax application, and the definition of the term Ajax. In particular, it has been noted that:
  • JavaScript is not the only client-side scripting language that can be used for implementing an Ajax application. Other languages such as VBScript
    VBScript

    VBScript is an Active Scripting language, developed by Microsoft, which uses the Component Object Model to access elements of the environment within which it's running ....
     and EGL Programming Language are also capable of the required functionality.
  • XML is not required for data interchange and therefore XSLT is not required for the manipulation of data. JavaScript Object Notation
    JSON

    JSON , short for JavaScript Object Notation, is a lightweight computer data interchange format. It is a text-based, human-readable format for representing simple data structures and associative arrays ....
     (JSON) is often used as an alternative format for data interchange, although other formats such as preformatted HTML or plain text can also be used.


Critique


Advantages

  • In many cases, related pages on a website consist of much content that is common between them. Using traditional methods, that content would have to be reloaded on every request. However, using Ajax, a web application can request only the content that needs to be updated, thus drastically reducing bandwidth usage and load time.
  • The use of asynchronous requests allows the client's Web browser UI to be more interactive and to respond quickly to inputs, and sections of pages can also be reloaded individually. Users may perceive the application to be faster or more responsive, even if the application has not changed on the server side.
  • The use of Ajax can reduce connections to the server, since scripts and style sheets only have to be requested once.


Disadvantages

  • Pages dynamically created using successive Ajax requests do not automatically register themselves with the browser's history engine, so clicking the browser's "back" button may not return the user to an earlier state of the Ajax-enabled page, but may instead return them to the last full page visited before it. Workarounds include the use of invisible IFrame
    IFrame

    IFrame is an HTML element which makes it possible to embed an HTML document inside another HTML document.The size of the IFrame can be specified in the surrounding HTML page, so that the surrounding page can already be presented in the Web browser while the IFrame is still being loaded....
    s to trigger changes in the browser's history and changing the anchor portion of the URL (following a #) when AJAX is run and monitoring it for changes.
  • Dynamic web page updates also 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
    Fragment identifier

    In computer hypertext, a fragment identifier is a short Character string of character s that refers to a resource that is subordinate to another, primary resource....
     (the portion of a URL after the '#') to keep track of, and allow users to return to, the application in a given state.
  • Because most web crawler
    Web crawler

    A Web crawler is a computer program that browses the World Wide Web in a methodical, automated manner. Other terms for Web crawlers are ants, automatic indexers, bots, and worms or Web spider, Web robot, or?especially in the FOAF community?Web scutter....
    s do not execute JavaScript code, web applications should provide an alternative means of accessing the content that would normally be retrieved with Ajax, to allow search engine
    Search engine

    A search engine is an information retrieval designed to help find information stored on a computer system. The search results are usually presented in a list and are commonly called hits....
    s to index it.
  • Any user whose browser does not support Ajax or JavaScript, or simply has JavaScript disabled, will not be able to use its functionality. Similarly, devices such as mobile phone
    Mobile phone

    A mobile phone is a long-range, electronic device used for mobile voice or data communication over a network of specialized base stations known as cell sites....
    s, PDA
    PDA

    PDA may refer to:...
    s, and screen reader
    Screen reader

    A screen reader is a Application software that attempts to identify and interpret what is being displayed on the screen . This interpretation is then re-presented to the user with text-to-speech, sound icons, or a Refreshable Braille display....
    s may not have support for JavaScript or the XMLHttpRequest object. Also, screen readers that are able to use Ajax may still not be able to properly read the dynamically generated content. The only way to let the user carry out functionality is to fall back to non-JavaScript. This can be achieved by making sure links and forms can be resolved properly and rely not solely on Ajax. In JavaScript, form submission could then be halted with "return false".
  • The same origin policy
    Same origin policy

    In computing, the same origin policy is an important computer security concept for a number of client-side scripting, such as JavaScript. In a nutshell, the policy permits scripts running on pages originating from the same site to access each other's methods and properties with no specific restrictions — but prevents access to most meth...
     prevents Ajax from being used across domains, although the W3C has a draft that would enable this functionality.
  • The lack of a standards body behind Ajax means there is no widely adopted best practice to test Ajax applications. Testing tools for Ajax often do not understand Ajax event models, data models, and protocols.
  • Opens up another attack vector for malicious code that web developers might not fully test for.


See also

  • Ajax framework
    Ajax framework

    An Ajax framework is a Web application framework that helps to develop web applications that use Ajax , a collection of technologies used to build dynamic web pages on the client side....
  • Reverse Ajax
    Reverse Ajax

    Reverse Ajax refers to an Ajax design pattern that uses long-lived [] connections to enable Latency communication between a web server and a web browser....
  • Rich Internet application
    Rich Internet application

    Rich Internet applications are web applications that have some of the characteristics of Application software, typically delivered by way of an Ajax framework, Proprietary software web browser Plug-in s, advanced javascript compiler technology, or independently via Sandbox es or virtual machines....
  • XMLHttpRequest
    XMLHttpRequest

    XMLHttpRequest is a Document Object Model Application programming interface that can be used inside a web browser scripting language, such as Javascript, to send an Hypertext Transfer Protocol directly to a web server and load the Response data directly back into the scripting language....


External links


  • at the Open Directory Project
    Open Directory Project

    The Open Directory Project , also known as Dmoz , is a multilingual open content Web directory of World Wide Web links owned by Netscape that is constructed and maintained by a virtual community of volunteer editors....
    .
  • with get, post, text and XML examples.
  • Presentation on Ajax Security issues given at the Black Hat
    Black Hat Briefings

    Black Hat is a corporation founded in 1997 by Jeff Moss , most famous for organizing a network of conferences known for providing new and exclusive insights about upcoming information security trends....
     security conference.