0

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?Asset=123

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.

Thanks

HoldOffHunger
  • 18,769
  • 10
  • 104
  • 133
Mike
  • 1
  • 1
    You need to go ahead and study GET/POST methods, potentially working with AJAX/JSON responses. Think that's where you may be getting lost Mike, fast tutorial. – BGPHiJACK Jun 11 '21 at 10:58
  • you can add as much as you want and in any order. Why do you use GET parameters? – Greg-- Jun 11 '21 at 10:58
  • This might be a useful post maybe? https://stackoverflow.com/questions/979975/how-to-get-the-value-from-the-get-parameters – Bojan Tomić Jun 11 '21 at 10:59
  • Thanks for the comments, @Blanknamefornow I've been trying to study GET methods online but nothing I've been able to find shows me how to do what I want to do. If there are any Tutorials you'd recommend that would be great. – Mike Jun 15 '21 at 07:34
  • Thanks @Greg I'm Using GET as the final application needs the data as URL Parameters, is there a better way to achieve this but still end up with the variables set as URL parameters? – Mike Jun 15 '21 at 07:35
  • @Bojan Thanks for the link, still not really getting it though. To be honest, not really understanding a lot of it, so maybe need to go back to basics first. – Mike Jun 15 '21 at 07:37

1 Answers1

0

Thanks For the Suggestions guys, eventually got it working by following this model;

stackoverflow.com/a/975106/16196632

Pulling the URL Parameter using;

const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString); 
var ass = urlParams.get('assetNo')
Mike
  • 1