in Code, Internet, Kompjuteri i IT, Razno

Ajax – new Web technology [en]

Ajax – Asynchronous JavaScript and XML is web development technique for creating interactive web applications using a combination of:

  • XHTML (or HTML) and CSS for presenting information
  • The Document Object Model manipulated through JavaScript to dynamically display and interact with the information presented
  • The XMLHttpRequest object to exchange data asynchronously with the web server. (XML is commonly used, although any format will work, including preformatted HTML, plain text, JSON and even EBML)

Ajax is not new technology, it is combinations of known technologies together. The techniques have been in use since around 1998.

ajax modelAjax applications look almost as if they reside on the user’s machine, rather than across the Internet on a server. The reason: pages get updated, not entirely refreshed. “Every user’s action that normally would generate an HTTP request takes the form of a JavaScript call to the Ajax engine instead”, wrote Jesse James Garrett, in the essay that first defined the term. “Any response to a user action that doesn’t require a trip back to the server — such as simple data validation, editing data in memory, and even some navigation — the engine handles on its own. If the engine needs something from the server in order to respond — if it’s submitting data for processing, loading additional interface code, or retrieving new data — the engine makes those requests asynchronously, usually using XML, without stalling a user’s interaction with the application.”

Traditional web applications essentially submit forms, completed by a user, to a web server. The web server responds by sending a new web page back. Because the server must submit a new page each time, applications run more slowly and awkwardly than their native counterparts.

The biggest advantage of using Ajax technologies is that data can be manipulated without having to render the entire page again in the web browser. This allows web applications to respond more quickly to many types of user interaction and to avoid repeatedly sending unchanged information across the network. Some browsers do not support JavaScript or ActiveX. Security settings might cause even Internet Explorer to not support Ajax (ex: JavaScript might be disabled). This is the major con for Ajax. This is comparable to the days of DHTML when it was not supported by many browsers.

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. Returning to the previous state may not be possible when a page is updated dynamically, since browsers typically record only static page visits in their history lists. The distinction between a static page, loaded in its entirety, and a page which has been modified dynamically might be a subtle one; users generally expect that clicking the back button in web applications will undo their last change and in Ajax applications this might not be the case

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 optimally 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.

Ajax is suported by every browser:

  • Apple Safari 1.2 and above
  • Konqueror
  • Internet Explorer (and derived browsers) 4.0 and above
  • Mozilla Firefox (and derived browsers) 1.0 and above
  • Netscape 7.1 and above
  • Opera 7.6 and above

PHP Scripts and libraryes for ajax

  • HTML_Ajax PHP and JavaScript Ajax
  • XOAD (formerly NAJAX) PHP based AJAX/XAP object oriented framework.
  • xajax PHP Ajax toolkit
  • sajax Simple Ajax Toolkit by ModernMethod
  • pajax Pajax toolkit
  • Class Ajax Customize JavaScript XML HTTP Request Object components from PHP.
  • Pajaj PAJAJ: PHP Asynchronous Javascript and JSON
  • symfony PHP framework with AJAX integration (based on Rails and script.aculo.us)

Write a Comment

Comment