What is the simplest way to pas a URL parameter to another URL?

  html, javascript, parameter-passing, url

I’ve been through the site and can’t find an answer to this question, guessing because it’s one of those things that’s obvious to everyone, but me. I’ve simplified the example below to hopefully make it clear what I’m looking for…

I have a web page accessed from another page where the Variable "Asset" is set, so the Url looks like;


webpage.com has a number of links to another page (Page2.com) with different parameters to which I need to add the incoming asset parameter. I’m using HTML.

the base links for example are;

Link1 is;      Page2.com?Site=1&Plant=4&Priority=C

Link2 is;      Page2.com?Site=1&Plant=1&Priority=A

but I need the links to be;

Link1;      Page2.com?Site=1&Plant=4&Priority=C&Asset=123

Link2;      Page2.com?Site=1&Plant=1&Priority=A&Asset=123

I’m at a very basic level so the simpler the solution the better. It’s an internal system so the actual parameters are pretty well restricted to predefined values so we don’t need any processing or filters etc. the parameters will all be correct and always the correct format.


Source: Ask Javascript Questions