Reputation: 25
I'm using the shorthand $.get
instead of $.ajax{type : "GET ... }
Is it possible to define the Authorization header with this shorthand?
Upvotes: 1
Views: 560
Reputation: 118299
Yes add the headers: {}
key. Check setting from Jquery official doc.
$.get({headers: {}})
The offcial doc says:
A set of key/value pairs that configure the Ajax request. All properties except for
url
are optional. A default can be set for any option with$.ajaxSetup()
. SeejQuery.ajax( settings )
for a complete list of all settings. Thetype
option will automatically be set toGET
.
Upvotes: 1