Reza Owliaei Reza Owliaei -4 years ago 161
HTML Question

How to set a Header field on POST a form?

How can I set a custom field in POST header on submit a form?

Answer Source

It cannot be done - AFAIK.

However you may use for example jquery (although you can do it with plain javascript) to serialize the form and send (using AJAX) while adding your custom header.

Look at the jquery serialize which changes an HTML FORM into form-url-encoded values ready for POST.


My suggestion is to include either

  • a hidden form element
  • a query string parameter
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download