Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add a loading animation to jquery ajax .load()

Tags:

People also ask

How can I create a please wait loading animation using jQuery?

Answer: Use the ajaxStart() and ajaxStop() Method Please Wait" is popular way to indicate the user that Ajax request is in progress. You can create a preloader using the jQuery ajaxStart() and ajaxStop() method.

What is the load () method used for in jQuery?

The jQuery load() method is a simple, but powerful AJAX method. The load() method loads data from a server and puts the returned data into the selected element.

How display loading image or loader when Ajax call is in progress?

You can display the image just before this call to $. ajax() and then hide/remove the image in the post handler function (just before your . empty()/. append(data) calls.


I currently have this code and it's pretty simple

$('#window').load('http://mysite.com/mypage.php');

But it shows the content only after fully loaded and during that duration the #windows element remains empty. I want to show a loading image until the page loads. How should i do it? The jquery site explains nothing about it. (afaik)