I\'m a newbie to web development with regards to using a server and jQuery. What I\'m creating as an assignment to learning Django before I do my big employment project is simpl
The thing to understand is that load
, which is an Ajax call, is asynchronous. That means that the Javascript continues executing while the request is being made. In order to do something when the call completes, you pass a callback function as a parameter to load
. jQuery automatically calls that function when the Ajax is finished loading.
$("#listOfThingsToDo").load(document.URL + ' #listOfThingsToDo', function() {
$(".checkbox-task:last").hide();
$(".checkbox-task:last").fadeIn(500);
});
You can see that the hide and fadeIn calls are within the anonymous function, so they will only be executed when the Ajax request is complete.