var oTable;
$(document).ready(function() {
oTable = $('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "module/parents/calendar/file_proc.php",
"fnServerData": function ( sSource, aoData, fnCallback, oSettings ) {
oSettings.jqXHR = $.ajax( {
"dataType": 'json',
"type": "GET",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
if (typeof $ !== "undefined" && $.fn.dataTable) {
var all_settings = $($.fn.dataTable.tables()).DataTable().settings();
for (var i = 0, settings; (settings = all_settings[i]); ++i) {
//alert(676);
if (settings.jqXHR)
settings.jqXHR.abort();
}
}
},
"aoColumns": [
{ "sWidth": "320px"},
{ "sWidth": "70px"},
{ "sWidth": "100px"},
{ "sWidth": "180px"},
{ "bVisible": false },
],
"aaSorting": [[2, 'desc']]
});
});
</script>
我在旧网站上使用jquery dataTable
1.6.2。当用户在datatables插件中搜索搜索框中的内容时,它会在每次按键后加载ajax请求。我搜索了谷歌并实施了代码,用于中止以前的ajax请求,但它无效。
搜索字段ID html标记为
<input id="tt" type="text">