This section outlines the benefits and drawbacks of AJAX.
Benefits
Low usage of bandwidth – AJAX facilitates faster web page
renderings by reducing the web server hits. AJAX pages can load much faster
when the payload coming down is lesser in size. This is achieved by generating
the HTML locally within the browser and also the JavaScript calls and actual
data is brought down. A large result set having data from multiple pages can be
a good example in this regard. AJAX allows loading the HTML content of the page
(with table structures and its tags) locally in the web browser. Additionally,
some web applications load stubs of event handlers and subsequently “load the
functions on the fly.” All of these help in managing the optimal consumption of
bandwidth for applications having complex functions and logic.
Usage of XMLHttpRequest – It is able to make requests to
pages not set up for AJAX, can set or get all HTTP headers, can make HTTP
requests using any type (GET, POST, PROPFIND, and so on), supports full control
over POST requests and allows for any type of data encoding.
Drawbacks
Response Time – AJAX based development should take care of
the response time between client requests and server response as it normally
gets delayed due to the fact that smart preloading of data and proper handling
of XMLHttpRequest object may cause delay in lining up with the web application.
Back button in the web browser does not work – In AJAX based
development, the pages that are created dynamically do not get stored into the
browser history and the “Back” button in the user’s browser will not work in
this case.
JavaScript Dependency – AJAX based development depends on
JavaScript to a great extent. JavaScript is implemented differently in different
web browsers and proper caution needs to be taken to ensure that the web pages
behave the same in different browsers.