DataTables / Vue

Vue plugin for DataTables
MIT License
62 stars 12 forks source link

Add custom headers for AJAX request #8

Closed swilla closed 1 year ago

swilla commented 1 year ago

Is there a way to add headers to the ajax requests? Previously the default JQuery settings appended them, but when I switch to this package they are not appended to the request.

AllanJard commented 1 year ago

It might be using a different instance of jQuery? Try DataTables.use(jQuery) (or whatever your local jQuery is). Or do:

ajax: {
  url: ...,
  headers: {
   ...
  }
}

in your DataTable initialisation.

swilla commented 1 year ago

Perfect, exactly what I needed. Thank you!