Hello,
I am trying to show loading gif image before starting of ajax and hide after its completion but it's not working. can anyone guide me ?
My code is for ajax function:
onSave: function (data) {
$.ajax({
type: "POST",
url: pageUrl + "/GetCapturedImage",
data: '',
contentType: "application/json; charset=utf-8",
dataType: "json",
beforeSend: function(){
$('#loading').show()
},
complete: function(){
$('#loading').hide();
},
success: function (r) {
$("[id*=imgCapture]").css("visibility", "visible");
$("[id*=imgCapture]").attr("src", r.d);
},
failure: function (response) {
alert(response.d);
}
});
}
and for HTML:
Loading. Please wait.

3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Bryian TanRank #396 · 6.3K reputationPosted Mar 29, 2017, 6:28 PM EDT
Rahul Lakshakar193 reputationPosted Mar 30, 2017, 12:48 AM EDT
Bryian TanRank #396 · 6.3K reputationPosted Mar 30, 2017, 6:41 PM EDT