I’ve a rating submission form. In form.onSubmit()
, I capture the rating data, redirect to a “thank you page” with window.location.replace(url)
.
I’m trying to append the rating data in the new page. However, once the page is replaced, I can access the formData variable, but, DOM of the new page seems inaccessible.
Code:
function handleSubmit(e) {
e.preventDefault();
const formData = new FormData(form);
window.location.replace('thankyou.html');
console.log(formData.get('rating'));
// dom not accessible after replace
console.log(document.body);
}
Any leads?