【发布时间】:2020-04-02 21:53:10
【问题描述】:
我想将一个 Id 从 jquery 数据表传递给另一个 jquery 函数。
这是我也想传递 Id 的 jquery 函数
$("#makeEditable").on('mousedown.save', "i.save.material-icons", function (e) {
$.ajax({
type: 'GET',
url: '/gestiondeubicaciones/Editar',
data: { id: 3 }, /* How to pass id here???*/
cache: false,
success: function (result) {
}
});
$(this).text("edit").removeClass().addClass("edit material-icons");
var $row = $(this).closest("tr");
var $tds = $row.find("td").not(':last');//.not(':first');
$.each($tds, function (i, el) {
var txt = $(this).find("input").val()
$(this).html(txt);
});
});
更具体地说,我想用变量替换 3
data: { id: 3 }, /* How to pass id here???*/
这是我的数据表代码
var table;
table = $('#makeEditable').DataTable({
rowReorder: {
selector: 'td:nth-child(2)'
},
responsive: true,
ajax: "/gestiondeubicaciones/GetUbicaciones",
columns: [
{ data: "armario" },
{ data: "cajon" },
{
data: "ubicacion_id", "width": "50px", "render": function (data) {
return '<a class="popup-edit"><i id="editSave" class="edit material-icons" title="Detalles">edit</i></a>' +
'<a class="popup-delete" href="#" onclick="DeleteData(' + data + ');" title="Eliminar"><i class="delete material-icons">delete</i></a>';
}
}
]
更具体地说,我想将数据传递给 jquery 函数。
function (data) {
return '<a class="popup-edit"><i id="editSave" class="edit material-icons" title="Detalles">edit</i></a>'
如何将数据从 jquery 数据表传递到 jquery 函数。谢谢您的帮助。
【问题讨论】:
标签: jquery asp.net-mvc razor datatables