How can I pass java script object between html pages | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I pass java script object between html pages

I created a quiz page and U don't want to give users results on the same page so I want to get results from quiz page to results page using java script

11th Jan 2019, 5:00 PM
Khaukanani Lawrence
Khaukanani Lawrence - avatar
7 Answers
+ 3
If nobody will see source code just add it as variable. Then set innerHTML of your elements (maybe whole body) to this value.
11th Jan 2019, 5:28 PM
Maneren
Maneren - avatar
+ 1
Isn't better to just store it in variable (user probably won't look to source code
11th Jan 2019, 5:17 PM
Maneren
Maneren - avatar
+ 1
In that case you can use Local Storage to pass data from one file to the other: https://www.w3schools.com/html/html5_webstorage.asp
11th Jan 2019, 5:53 PM
Ulisses Cruz
Ulisses Cruz - avatar
0
Khaukanani Lawrence are you creating the quiz in the Sololearn Playground, in your computer or on a Server?
11th Jan 2019, 5:24 PM
Ulisses Cruz
Ulisses Cruz - avatar
0
On my computer using javascript
11th Jan 2019, 5:26 PM
Khaukanani Lawrence
Khaukanani Lawrence - avatar
0
Did you create one file (.html) for the quiz and another to the result?
11th Jan 2019, 5:28 PM
Ulisses Cruz
Ulisses Cruz - avatar
0
yes
11th Jan 2019, 5:29 PM
Khaukanani Lawrence
Khaukanani Lawrence - avatar