O'Reilly logo

Developing Responsive Web Applications with AJAX and jQuery by Sandeep Kumar Patel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building a jQuery AJAX method

In this section, we will learn to develop a jQuery AJAX method in order to make server calls. The following figure shows the block diagram of a typical communication between a client and a server done through a sequence of requests and responses, where each request is triggered by an AJAX call:

Building a jQuery AJAX method

jQuery provides an AJAX method $.ajax() to call the remote data. For our application, we will call our servlet ProductServlet to download the product list in the JSON format. The AJAX method makes an XMLHttpRequest request to the servlet to get the data.

The syntax for the AJAX method is shown as follows:

$.ajax(<url>,{configuration ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required