05 марта, 2006
AJAX
О технологии AJAX - фундаменте строительства Web 2.0, и фундаменте технического совершенства Flickr:
Asynchronous JavaScript And XML, or its acronym AJAX (pronounced A-JAX), is a Web development technique for creating interactive web applications. The intent is to shift a great deal of interaction to the Web surfer's computer, exchanging 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), CSS, and increasingly SVG for marking up and styling information.
- The DOM accessed with a client-side scripting language, especially ECMA Script implementations like 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 some situations, an IFrame object is used instead of the XMLHttpRequest object to exchange data with the web server.
- XML is commonly used as the format for transferring data, although any format will work, including preformatted HTML, plain text, JSON and even EBML.
Like DHTML, LAMP, or SPA, AJAX is not a technology in itself, but a term that refers to the use of a group of technologies together. In fact, derivative/composite technologies based substantially upon AJAX, such as AFLAX, are already appearing.
Pros
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 are required to be sent to the server, and relatively short responses are sent back. This permits the development of more interactive applications.
Portability
AJAX applications use well-documented features present in all major browsers on most existing platforms. Though this situation could feasibly change in the future, at the moment, AJAX applications are effectively cross-platform. While the AJAX platform is more restricted than the Java platform, current AJAX applications effectively fill part of the one-time niche of Java applets: extending the browser with lightweight mini-applications.
Cons and criticism
Usability criticisms
One major complaint voiced against the use of AJAX in web applications is that it might easily break the expected behavior of the browser's back button. Users generally expect that clicking the back button in web applications will undo their last state change and in AJAX applications this might not be the case. Developers have implemented various solutions to this problem.
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, 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 is often suggested solution to these latency issues.
Name issues
There have been some critics of the term AJAX, claiming that Adaptive Path (the consulting firm that coined the term) or other proponents are using it as a marketing vehicle for previously-used techniques.