Answer the question
In order to leave comments, you need to log in
How to make a function load in 3 seconds?
Good evening!
How to make the startLoadingAnimation() function work for 3 seconds, and then the response from the server comes?
$(document).ready(function(){
var $form = $('#filter'),
$controls = $form.find('input,select,textarea');
$controls.on('change', function(){
startLoadingAnimation();
$.post("url", $("#filter").serialize(), function(response){
$('#dle-content').html(response); stopLoadingAnimation();
});
});
});
function startLoadingAnimation()
{
$("#dle-content").append('<div id="res"><img src="http://katushka.in.ua/templates/katushka2/images/ajax-loader.gif" /></div>');
}
function stopLoadingAnimation()
{
$("#res").remove();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question