Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

91
Views
Carrying over data from one html page to another using javascript

Hi i have a two page basic website with a submission box where you write down a name, then a second page that displays "Welcome___", however my website displays ?Welcome=___, I know i need to parse a query string but I'm not sure how to

form.html

<body>
<form action="action.html" method="GET">
<input type="text" name="Welcome" />
<input type="submit" value="Submit" />
</form>
</body> 

action.html

<body>
<div id="write">
<p> Welcome  </p>
</div>
<script>
document.getElementById("write").innerHTML = window.location.search; 
</script>
</body>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

To parse the querystring and extract from it the parameter you want the URLSearchParams interface offers useful methods to help you do what you want. A simple implementation might look like this.

<form action='action.html' method='GET'>
    <input type='text' name='Welcome' />
    <input type='submit' />
</form>


<div id='write'>
    <p>Welcome </p>
</div>

<script>
    let args=new URLSearchParams( location.search );
    if( args.has('Welcome') ){
        document.getElementById('write').querySelector('p').textContent += args.get('Welcome');
    }
</script>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!