1

I don't have any expertise in programming, just from the little I've researched to solve one-off needs. However, the one thing I can't seem to find answers for is populating dynamic content on a page.

I currently build my website with no code programs (Airtable as my back-end). For my work, my clients each receive a link to a webpage that contains a few client-specific variables (name, birthdate, pdf link) - is it possible to pass these parameters through the URL to have them show on the webpage?

I assumed it would function similarly to passing form data to a thank you page URL, is this theory correct? And if so, can anyone help with what I need to do/what html & js codes I need to implement to make this happen?

Thanks in advance (this would make my life a million times easier)!

  • Have a look here on how to grab the parameters with JS :) https://www.sitepoint.com/get-url-parameters-with-javascript/ If you build up your HTML you can easily set the parameters from the URL to specific HTML elements. If you're blank on the HTML part I could make a full example for you? – Egil Hansen Apr 03 '22 at 16:15
  • @EgilHansen oh, thank you so much for your offer! I'm going to play around with it to see if I can figure it out myself, but will certainly follow-up with you if I can't. This article is very helpful – Taylor Johnston Apr 05 '22 at 02:07
  • Hehe, I just meant I could make a simple example, like I went ahead and did ;) Please tick the box on my answer if you accept the solution :) – Egil Hansen Apr 05 '22 at 06:27

2 Answers2

1

Yes you can easily parse URL parameters with JS, see simple example bellow:

https://exampleurl.com/?birthdate=22091977&pdflink=yourlink123.pdf

<html>
    <body>
        <span id="birthdate"></span>
    </body>
</html>

<script>
    const queryString = window.location.search;
    const urlParams = new URLSearchParams(queryString);
    const birthdate = urlParams.get('birthdate');
    const pdflink = urlParams.get('pdflink');
    document.getElementById("birthdate").innerHTML = birthdate;
</script>
Egil Hansen
  • 158
  • 2
  • 8
0

you can completely pass parameters via URL. eg: your_domain.com/name1/birth-date/code-pdf