//edit function
$('#dataTable tbody').on('click', '.am-text-secondary', function() {
//get the id of selected row
var rowData = table.row($(this).parents('tr')).data();
var updateId = rowData.id;
if(!updateId)
return;
console.log("updateId_1:"+updateId);
$.ajax({
url: "getDataById.do?id="+updateId,
success: function (data) {
//assign the editModal
}
});
$('#editModal').modal({
relatedTarget: this,
width:600,
onConfirm: function(options) {
console.log("updateId_2:"+updateId);
$.ajax({
//do something
});
}
});
});
當第一觸發編輯功能,updateId_1和updateId_2示出26.數據表JS變量不被更新
但隨後第二觸發器,updateId_1示出了27,updateId_2仍顯示26 ...
問題在哪裏?
你使用哪種插件模式? –