Avatar of Rohit Bajaj
Rohit Bajaj
Flag for India asked on

How do i pass headers when specifying a location with window.location.href

HI,
Currently i am on a html page which has an submit button. And when that button is clicked the user goes to the url :
url?validation=...& etc
This is achived by setting a on click listener on submit button and executing :
window.location.href =url?validation=...
How do i achive the same if i want to pass this validation in the headers... Is there any way i can specify headers with window.location.href ??
OR any alternative way to achive the same using javascript etc.


Thanks
JavaScriptWeb DevelopmentHTMLjQuery

Avatar of undefined
Last Comment
Julian Hansen

8/22/2022 - Mon
SOLUTION
James Bilous

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Julian Hansen

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Rohit Bajaj

ASKER
i mean the actual headers. the way we specify headers in an ajax call. but i think ajax call wont transfer me to another page it will just take a request and will get the response in the callback.
my aim is to actually to transfer the user to another page. but the validationID etc fields dont seem right in the query parameters logically.   Although i do achieve what i want to achieve using location.href ... that is transfer the user to other page and i embed this validationId in the resulting page
SOLUTION
James Bilous

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Julian Hansen

Can you give me an example of how you would do this with AJAX - just want to make sure I understand exactly what you are asking.

Why do you need to embed information in the header - there is scope for this in some applications but the usual method of data transfer is in the URL (parameters retrieved with a GET) or as POST data. Why specifically do you need to modify the headers
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck