ajax beforesend code example
Example 1: jquery ajax post
$.ajax({
type: "POST",
url: url,
data: data,
success: success,
dataType: dataType
});
Example 2: jquery abort ajax
var xhr = $.ajax({
type: "GET",
url: "https://www.codegrepper.com/myapi.php",
success: function(response){
//do something
}
});
xhr.abort(); //kill the request