Display Loading Image when AJAX Call is in Progress

Posted by

Are you searching for a display loading picture on an ajax call example. We’ll put a jQuery show loading picture on ajax call into practise in this tutorial. detail how to load a picture using ajax and javascript. I want to share ajax with you while processing. follow the example below to display an image while your ajax page loads.

Sometimes, rather than only for one Ajax request, we want to display a loading picture, animation, or text whenever an Ajax request is fired. Use the example below if you want to show an image for each Ajax request. I display a picture using the ajaxStart() and ajaxComplete() calls until all POST or GET Ajax requests have been fulfilled. For each $.ajax request, these functions will run once.

Example:

<script type="text/javascript">
    $(document).ready(function()
    {
        $(document).ajaxStart(function(){
	    	$('#img').css("display", "block");
	});
	$(document).ajaxComplete(function(){
		$('#img').css("display", "none");
	});
    });
</script>
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x