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:
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: