Skip to content Skip to sidebar Skip to footer

How To Submit A Html Form With Header

I want to submit a form including a header during posting the request , is that possible ? I tried below code but I was unable to send the request with the defined header . <

Solution 1:

I want to submit a form including a header during posting the request , is that possible ?

No.

You can only add custom HTTP headers to a request if you are using XMLHttpRequest or fetch to make the request (so you can't if you are using a form submission to make the request).

You could use the submit event to intercept the form submission and make the request with XMLHttpRequest or fetch instead … but then you'd need to handle the response with JS too.

Post a Comment for "How To Submit A Html Form With Header"