After a user submits a form, they are redirected to a page with this url:
example.com?name=John
How can I put 'John' into a div on the page, so that the page displays 'Thank you John' ?
After a user submits a form, they are redirected to a page with this url:
example.com?name=John
How can I put 'John' into a div on the page, so that the page displays 'Thank you John' ?
I'm not sure if i did understand you correctly, but if i did, you could get the value from query string and then change the div content just using vanilla JS.
Like this:
const name = new URLSearchParams(window.location.search).get('name') ?? "John";
const greeting = document.getElementById("greeting")
if(typeof(name) !== 'undefined' && name !== null){
greeting.innerHTML = `Thank you ${name}`
greeting.style.visibility = "visible"
}
<html>
<div id="greeting" style="visibility:hidden"></div>
</html>
Ignore the ?? John is to have something to show without an actual query string.
Hope this is what you are looking for.