Laravel-datatables: Pass Params through url

Created on 20 Jan 2018  路  2Comments  路  Source: yajra/laravel-datatables

Hello
i am trying pass params through this url:
http://test.com/admin/archive?hoteltitle=name&department=rooms

columns: [
{ data: 'mainid', name: 'mainid' },
{ data: 'objecttitle', name: 'objecttitle' },
{ data: 'department', name: 'department' },
{ data: 'hoteltitle', name: 'hoteltitle' },
{ data: 'categorytitle', name: 'categorytitle' },
{ data: 'description', name: 'description' },
{ data: 'created_at_dif', name: 'created_at_dif' },
{ data: 'updated_at', name: 'updated_at' },
{ data: 'statustitle', name: 'statustitle' },
{ data: 'prioritytitle', name: 'prioritytitle' },
{ data: 'actions', name: 'actions', orderable: false, searchable: false }
]

i am using ajax.params

 oTable.on( 'xhr', function () {
      var data = oTable.ajax.params();
      console.log('data', data.hoteltitle)
      console.log('data', data.department)

      //alert( 'Search term was: '+data.search.value );
  } );

how can i fetch them through the url

  • Operating System
  • PHP Version 7.2
  • Laravel Version 5.5
  • Laravel-Datatables Version "yajra/laravel-datatables-oracle": "~8.0"
question

Most helpful comment

Maybe using the ajax.data instead?

```js
var name = '{{ request('hotelname' }}';
var department = '{{ request('department' }}';

// on dt options
ajax: {
url: '',
data: function(d) { d.hoteltitle = name, d.department = department }
}

All 2 comments

Maybe using the ajax.data instead?

```js
var name = '{{ request('hotelname' }}';
var department = '{{ request('department' }}';

// on dt options
ajax: {
url: '',
data: function(d) { d.hoteltitle = name, d.department = department }
}

works thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sangnguyenplus picture sangnguyenplus  路  3Comments

hohuuhau picture hohuuhau  路  3Comments

Abdulhmid picture Abdulhmid  路  3Comments

jackrsantana picture jackrsantana  路  3Comments

ahmadbadpey picture ahmadbadpey  路  3Comments