gpt4 book ai didi

jquery - 数据表ajax重新加载不更新传递的参数

转载 作者:行者123 更新时间:2023-12-01 01:00:12 25 4
gpt4 key购买 nike

使用ajax.relaod不会更新传递给 Controller ​​的值。每次进入函数时,变量都有正确的值,但我不确定如何重新加载以查看/接受更新的变量。我每次都需要销毁并重建表吗?

if (!$.fn.DataTable.isDataTable('.workorder-table')) {
$('.workorder-table').DataTable({
"initComplete": function () {
hidePleaseWait();
},
rowCallback: function (row, data, index) {
--row classes added here based on data
},
columns: [
{ "data": "Facility", "name": "Facility", "title": "Facility" },
{ "data": "ShortDescription", "name": "ShortDescription", "title": "Short Description" },
{ "data": "Created", "name": "Created", "title": "Created" },
{ "data": "Completed", "name": "Completed", "title": "Completed" },
{ "data": "Status", "name": "Status", "title": "Status" }
],
ajax: {
url: "/Facility/WorkOrderSearch",
type: "POST",
data: { status: $('#Status').val(), facilityID: $('#FacilityID').val(), quickView: $('#QuickView').val() }
},
-- options here
});
} else {
$('.workorder-table').DataTable().ajax.reload(hidePleaseWait);
}

最佳答案

如果data变成了可以执行的函数

data: function(data) {
data.status = $('#Status').val();
data.facilityID = $('#FacilityID').val();
data.quickView = $('#QuickView').val();
}

然后这个函数将在每次请求时执行,即当ajax.reload()被调用时。

关于jquery - 数据表ajax重新加载不更新传递的参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44566061/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com