-3

I have an assignment where I have to display user input from a form onto a new html page. The teacher mentioned using the url of the results page to get all the user input data from the previous page, but didn't explain it in depth. How do I get the url from the browser, split it at the &, to display the user input? We are using JavaScript. I need an example code only using JavaScript, no Jquery, and possibly no functions, to better understand how to do it. Thanks in advance.

  • https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_is_a_URL – haim770 Apr 24 '18 at 07:30
  • Check out this answer: https://stackoverflow.com/a/406208/1498053 Really think that should be the teachers job though to explain how it's done. – elveti Apr 24 '18 at 07:33
  • Im pretty sure this is what you are looking for : https://stackoverflow.com/questions/814613/how-to-read-get-data-from-a-url-using-javascript – Decoy Apr 24 '18 at 11:50

1 Answers1

0

Depending on the user input, if it is not sensitive data, i would go for URLSearchParams which allows to get and set data in the URL.

URLSearchParams

Advena
  • 1,664
  • 2
  • 24
  • 45