How to bring gift until the ajax response?

Hi , maybe the question is very simple but I'm just learning the basics of ajax
there is such code
$( document ).ready(function() {
$("#btn").click(
function(){
 sendAjaxForm('result_form', 'form1', 'ajax5.php');
 return false; 
}
);
}); 

function sendAjaxForm(result_form, ajax_form, url) {
jQuery.ajax({
 url: url, 
 type: "POST", 
 dataType: "html", 
 data: jQuery("#"+ajax_form).serialize(), 
success: function(html){ 
 $("#result_form").html(html); 
},
 error: function(response) { 
 document.getElementById(result_form).innerHTML = "Error.";
}
});
}

how to bring gift in the center of the screen until the response from the server ?
July 2nd 19 at 17:04
2 answers
July 2nd 19 at 17:06
Solution
Before the ajax call get the gift of success hide gift
July 2nd 19 at 17:08
Solution
Elementary, My Dear Watson!
beforeSend

function sendAjaxForm(result_form, ajax_form, url) {
jQuery.ajax({
 url: url, 
 type: "POST", 
 dataType: "html", 
 data: jQuery("#"+ajax_form).serialize(),
beforeSend: function() {
$(placeholder).addClass('loading');
},
success: function(html){ 
 $("#result_form").html(html); 
},
 error: function(response) { 
 document.getElementById(result_form).innerHTML = "Error.";
}
});
}

Find more questions by tags AJAXHTMLJavaScript