question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BeforeSend request header?

See original GitHub issue

On Jquery

$.ajax({ url : <url>, beforeSend : function(xhr) { xhr.setRequestHeader("authorization", token); },

how to add request header on tabulator?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jhnmrlscommented, Jan 28, 2017

OK, Nice workaround, never thought of that.

Thanks again. 😃

1reaction
olifolkerdcommented, Jan 28, 2017

If you need this token on all requests, then can i suggest you make a global adjustment to the jQuery ajax function. if you include the following line at the start of your project before making any request, then all future requests will be made with the header and you wont need to set it on each request:

$.ajaxSetup({ headers: {"authorization":token} });

This will also mean all Tabulator ajax requests will be effected too. You can use this to set any properties of the ajax request in a global fashion

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I add a custom HTTP header to ajax request with js ...
If you want to add a header (or set of headers) to every request then use the beforeSend hook with $.ajaxSetup() :
Read more >
How to add a custom HTTP header to ajax request ... - Edureka
To add a header to every request then use the beforeSend hook with $.ajaxSetup(): $.ajaxSetup({ beforeSend: function(xhr) { xhr.
Read more >
jQuery ajax headers | Learn the Working of the Ajax ... - eduCBA
beforeSend – This is an optional function. It set or overwrites to specify what type of response it can accept from the server....
Read more >
jQuery.ajax() | jQuery API Documentation
A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object before it is sent. Use this...
Read more >
How to add headers before sending Ajax Request using jQuery?
I was trying to add custom headers before sending ajax request to the server ... $.ajax({ url: url, beforeSend: function(xhr) { xhr.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found