Suppose you are doing an Ajax request and you want a loading image to show up till you get the result
You do something like this
But it is more than likely that this is not gonna workout and you will still see the image after the ajax request is completed. The solution would be to put a base64 encoded value of an empty image as the src like this
You do something like this
$('#loader_img').attr('src','images/ajax-loader.gif');
$.ajax({
type : "POST",
url : 'validate_form.php',
data : params
}).done(function(msg){
$('#loader_img').attr('src','');
});
But it is more than likely that this is not gonna workout and you will still see the image after the ajax request is completed. The solution would be to put a base64 encoded value of an empty image as the src like this
$('#loader_img').attr('src','data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==');
No comments:
Post a Comment