Here’s some examples of typical use cases where AJAX is used in the operation of your website:
- You run an eCommerce store with products that a user can add to their virtual cart. When a user navigates to their cart they might increase the quantity of a certain product and click
Update Cart. AJAX will send the new quantity to the server which will calculate a new total price. The new price is returned to the user’s web browser and displayed in the cart without the page reloading.
- You’ve built your website on a content management system and you want to delete a page. You navigate to the screen for managing pages which has a table showing all existing page. You click
Delete on the relevant page. Without AJAX, you would now wait several seconds while the page is deleted from the database and the whole page is reloaded. You lose control of the screen while this operation is happening. With AJAX, you never lose control of the screen. The page is deleted from the database in the background, and when it is complete AJAX will send back confirmation to the web browser that the deletion was successful. A message is then dynamically displayed on the screen showing the deletion was successful without the page reloading.
- You have a business directory website where users can search for businesses using a variety of criteria like location and category. Users fill in a form and search results are tabulated in a grid or list view. With AJAX, the user can change the search criteria, and the table will automatically update with new results without the page reloading.
Some Technical Detail
- Asynchronous – means the operation happens in the background at any time, separate to the loading of the whole web page.
Read more about AJAX at W3 Schools AJAX tutorials and the Wikipedia AJAX article.