url has a bunch of params I want to hide

Is there a way to hide the params when I change to a new page?

  window.location.href = "coursesearch.aspx?storeid=" + storeid +
                "&termid=" + termid +
                "&deptid=" + deptid +
                "&courseid=" + courseid +
                "&sectionid=" + sectionid +
                "&storetext=" + storetext +
                "&termtext=" + termtext +
                "&depttext=" + depttext +
                "&coursetext=" + coursetext +
                "&addtocart=yes" +
                "&sectiontext=" + sectiontext;
Tom KnowltonWeb developerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Instead of placing them in the URL, you could create a form and use "method=post" - that way the values are accessible on the new page via Request.Form("parameter") rather than Request.QueryString("parameter")...

Of course, that means you need to update the new page to read values from form post.

Another method would be to place params in a cookie... then change the target page to read values from the cookie if you wanted to.  But, you'd need to update your target page to read from the cookie... and if you don't want the values to persist you would want to empty the cookie out right after you read the values so that subsequent form submissions would not accidentally pick up old values.
If it's supported by the back-end, you can use POST variables instead of GET variables. For that to work, you'd need to build a form on-the-fly with the appropriate parameters and automatically submit it:

var frm = document.createElement("form");
frm.action = 'coursesearch.aspx';
frm.method = 'post';

var parm1 = document.createElement("input");
parm1.type = 'hidden';
parm1.name = 'termid';
parm1.value = termid;

var parm2 = document.createElement("input");
parm2.type = 'hidden';
parm2.name = 'deptid';
parm2.value = deptid;




Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Tom KnowltonWeb developerAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.