Does anyone know how to add or create a custom HTTP header using JavaScript or jQuery?
Assuming that you mean "When using ajax" and "An HTTP Request header", then use the headers
property in the object you pass to ajax()
headers(added 1.5)
Default:
{}
A map of additional header key/value pairs to send along with the request. This setting is set before the beforeSend function is called; therefore, any values in the headers setting can be overwritten from within the beforeSend function.
— http://api.jquery.com/jQuery.ajax/