Monday, August 27, 2012

javascript – Display image while running POST

I have this code that I use to POST without reloading the page, but I wonder how I can add that in the script being executed display an image. example loader.gif


Thanks for your help.



<script language=\"javascript\" src=\"jquery-1.6.4.min.js\"></script>
<script language=\"javascript\">
$(document).ready(function() {
$().ajaxStart(function() {
$(\'#loading\').show();
$(\'#result\').hide();
}).ajaxStop(function() {
$(\'#loading\').hide();
$(\'#result\').fadeIn(\'slow\');
});
$(\'#form, #fat, #form\').submit(function() {
$.ajax({
type: \'POST\',
url: $(this).attr(\'action\'),
data: $(this).serialize(),
success: function(data) {
$(\'#result\').html(data);

}
})

return false;
});
})






Rating: 2 out of 5 based on 4 ratings



The post javascript – Display image while running POST appeared first on Javascript ASK.






via Javascript ASK http://javascriptask.phpfogapp.com/javascript-display-image-while-running-post.html

No comments:

Post a Comment