Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82404

abort previous ajax request

$
0
0

Hi there,

I used this code for datatable...

$('#table').DataTable({
"destroy": true,
"processing": true,
"serverSide": true,
"columnDefs": [{
"targets": 0,
"orderable": false
}],
"ajax": {
url: baseURL + checkVal,
type: "post",
xhr: function() {
var xhr = $.ajaxSettings.xhr();
xhr.upload.onprogress = function(e) {
xhr.abort(); //abort all current request here
};
return xhr;
},
error: function() {
$(".employee-grid-error").html("");
$("#table").append('<tbody class="employee-grid-error"><tr><th colspan="3">No data found in the server</th></tr></tbody>');
}
},
'initComplete': function(settings, json) {
//code here
}
});

when I abort it will abort all current request... I want to stop all previous request when current request start running ... How to do that...

I used your all code which is posted in answer. But i can't get any value of settings.jqXHR or settings.jqXHR.abort() anywhere...

please help me how to abort all previous request..

Thanks in advance :)


Viewing all articles
Browse latest Browse all 82404


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>