2
我有一個帶有ajax調用的數據表。我形成這樣的表格:用ajax調用點擊重新加載數據表數據點擊
var _initTable = function() {
$('#datatables tr').not(':first').on('click', function() {
var dateandtime = $(this).find(':nth-child(3)').text();
window.location.href = '/results/detail/dateandtime/' + dateandtime;
});
};
$('#datatables').dataTable({
bProcessing : true,
sProcessing : true,
bServerSide : true,
sAjaxSource : '/results/load-results',
fnServerParams: function (aoData) {
aoData.push({"name": "quizid", "value": quizid },{ "name": "questionid", "value": questionid });
},
aoColumnDefs : [{'bSortable' : false, 'aTargets' : ['no-sort']}], // make the actions column unsortable
sPaginationType : 'full_numbers',
fnDrawCallback : function(oSettings) {
_initTable();
}
});
正如你所看到的,我發送2個參數給我的PHP動作。
現在我想重新加載表,當我點擊一個按鈕。所以我想要做的是另一個Ajax調用併發送其他參數(quizid將是相同的,但questionid將不同)。
我知道你有這樣的東西oTable.fnReloadAjax(newUrl);
但我應該粘貼在newUrl參數?
我做了的jsfiddle:http://jsfiddle.net/8TwS7/
然後我只是得到這個錯誤:Uncaught TypeError:Can not read pr operty'oFeatures'爲null – nielsv
你將不得不通過jsfiddle發佈你的整個源代碼,以便排除故障......某些東西沒有重擊並且沒有查看所有的源代碼我只能猜測 –
好的,我已經制作了一個jsfiddle。它不工作,鏈接不正確,但你可以看到我的代碼是怎樣的... http://jsfiddle.net/8TwS7/ – nielsv