I am using the Datatables plugin for jQuery, and I am trying to figure out how to resume the script once the AJAX call was successfull.
我正在使用jQuery的Datatables插件,我试图找出一旦AJAX调用成功后如何恢复脚本。
My current code is:
我目前的代码是:
var table = $("#dataTables-example").DataTable(
{
ajax: {
url: "/kleurmixer/hmi/view_json2.php?type=2",
dataSrc: '',
},
"aoColumnDefs": [
{ 'bSortable': false, 'aTargets': [ 7 ] },
{ 'bSortable': false, 'aTargets': [ 8 ] }
]
}
);
Now, in Chrome and FF it works. But since this is a page made for WinCC (which uses IE7), it doesn't work. So I need some kind of callback function for my AJAX call, but I can't figure out how to do it.
现在,在Chrome和FF中它可以工作。但由于这是为WinCC(使用IE7)制作的页面,因此不起作用。所以我需要某种回调函数用于我的AJAX调用,但我无法弄清楚如何做到这一点。
Help would be appreciated,
帮助将不胜感激,
Thanks,
1 个解决方案
#1
0
You could create a callback for done
or success
like this. You could also add error
and statusCode
if you need that.
您可以像这样创建完成或成功的回调。如果需要,还可以添加error和statusCode。
var table = $("#dataTables-example").DataTable(
{
ajax: {
url: "/kleurmixer/hmi/view_json2.php?type=2",
dataSrc: '',
"done": function(){
alert('done');
}
},
"aoColumnDefs": [
{ 'bSortable': false, 'aTargets': [ 7 ] },
{ 'bSortable': false, 'aTargets': [ 8 ] }
]
}
);
Update 1: Another datatable approach
更新1:另一种数据表方法
$("#dataTables-example").dataTable( {
"initComplete": function(settings, json) {
alert( 'DataTables has finished its initialisation.' );
}
} );
Documentation for Datatables initComplete
数据表initComplete的文档
#1
0
You could create a callback for done
or success
like this. You could also add error
and statusCode
if you need that.
您可以像这样创建完成或成功的回调。如果需要,还可以添加error和statusCode。
var table = $("#dataTables-example").DataTable(
{
ajax: {
url: "/kleurmixer/hmi/view_json2.php?type=2",
dataSrc: '',
"done": function(){
alert('done');
}
},
"aoColumnDefs": [
{ 'bSortable': false, 'aTargets': [ 7 ] },
{ 'bSortable': false, 'aTargets': [ 8 ] }
]
}
);
Update 1: Another datatable approach
更新1:另一种数据表方法
$("#dataTables-example").dataTable( {
"initComplete": function(settings, json) {
alert( 'DataTables has finished its initialisation.' );
}
} );
Documentation for Datatables initComplete
数据表initComplete的文档