Simple Ajax Using jQuery
Ajax is a technique for handling data without reloading a page or without sending a postback. Often we want a loading indicator while Ajax request (xmlhttp request) is processing. A simple example is gmail email load indicator. Implementing this requirement using jQuery is quite easy. Interesting fact is that jQuery encapsulates ajax events which makes development task for programmer easy. We will use ajaxSend and ajaxComplete events of jQuery. ajaxSend attach a function that should be executed before an ajax request is sent. On the other hand ajaxComplete attach a function that should be executed when an ajax request completes. Here are the steps:- 1. include the jquery.js file. Download it from http://jquery.com 2.bind an event to the div where loading image placed.Initially the div id " loading" is hidden. Code example is given below:- $(document).ready(function() { /*shows the loading div every time we have an Ajax call*/ ...