Conclusion

Ajax is a key part of modern applications, and jQuery is no slouch in providing a rich set of tools for you to work with.

For loading HTML content into DOM elements, the load() method provides an easy way to grab the content from the server and make it the content of any set of matched elements. Whether a GET or POST method is used is determined by the type of the data parameter provided.

When a GET is required, jQuery provides the $.get() and $.getJSON() utility functions. $.getJSON() is useful when JSON data is returned from the server. To force a POST, the $.post() utility function can be used.

When maximum flexibility is required, the $.ajax() utility function, with its ample assortment of options, lets you control the most minute aspects of an Ajax request. All other Ajax features in jQuery use the services of this function to provide their functionality.

To make managing the bevy of options less of a chore, jQuery provides the $.ajaxSetup() utility function that allows you to set default values for any frequently used options to the $.ajax() function (and for all of the other Ajax functions that use the services of $.ajax()).

To round out the Ajax toolset, jQuery also allows you to monitor the progress of Ajax requests by triggering Ajax events at the various stages, allowing you to establish handlers to listen for those events. You can bind the handlers using the on() method or use the convenience methods: ajaxStart()ajaxSend()ajaxSuccess()ajax-Error()ajaxComplete(), and ajaxStop().

Thanks to this impressive collection of Ajax tools under your belt, it’s easy to enable rich functionality in your web applications. With this in mind, let’s delve into our real-world demo.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *