I want to do something very simple. I have one button in my page.
try
$("#btnId").click(function(e){
e.preventDefault();
//show loading gif
$.ajax({
...
success:function(data){
//remove gif
},
error:function(){//remove gif}
});
});
EDIT: after reading the comments
in case you decide against ajax
$("#btnId").click(function(e){
e.preventDefault();
//show loading gif
$(this).closest('form').submit();
});