1beforeSend: function() {
2 // setting a timeout
3 $(placeholder).addClass('loading');
4 },
1$.ajax({
2 type: "POST",
3 url: url,
4 data: data,
5 success: success,
6 dataType: dataType
7});
8
1var xhr = $.ajax({
2 type: "GET",
3 url: "https://www.codegrepper.com/myapi.php",
4 success: function(response){
5 //do something
6 }
7});
8
9xhr.abort(); //kill the request