我有房屋和它们的details.am,能够显示一个datatable中的所有房屋。我在datatable中有一个列,用户单击该列并将它们重定向到另一个页面,其中所有details.here都是一个无法understand.on详细信息页面的小bug,该页面的详细信息显示在一个datatable中。我想将房屋的id传递给house details datatable函数,以便我可以将它传递给route.i已经尝试过了,但是我得到了一条没有定义错误的路由,这意味着id没有被传递。这是我的jquery代码。
//在datatable中显示房屋的所有租赁细节
$(document).ready(function(){
var hseid=$('#house_id').val();
var rentaldetailstable = $('#rentaldetailstable').DataTable({
processing:true,
serverside:true,
reponsive:true,
ajax:'{{ route("get_rentaldetails/' + hseid '") }}', //the hseid here isnt passed
columns: [
{ data: 'id' },
{ data: 'image',
render: function ( data, type, full, meta, row) {
return "<img src=\"/imagesforthewebsite/alternateimages/small/" + data + "\" height=\"80px\" height=\"80px\"/>"
}
},
{ data: 'status',name:'status',orderable:true,searchable:true },
{ data: 'delete',name:'delete',orderable:false,searchable:false },
],
});
});发布于 2022-07-20 11:38:52
我猜你失踪了:
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});在$.ajax内部:
type: 'post',
dataType: 'json',
success: function(response) {}https://stackoverflow.com/questions/73050782
复制相似问题