Display the content inside a division from another page after submitting a form in HTML
I am a product engineer and new to coding,
but now I am making a portfolio website from a template. I have successfully made a form and transferred the submitted contents to the Google Sheet, but I want to do more.
I want to embed the "thank you page" thankyou.html
inside the existing division <div id="newform">
of my webpage after submit a form. All I know is the code window.location.href
, but it will redirect the entire page to the thank you page, here is my code:
<script src = "//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" >
</script>
<script type = "text/javascript" >
$(document).ready(function() {
// References:
var $form = $('#myForm');
var $conf = $('#myConf');
var $subm = $('#mySubmit');
var $impt = $form.find(':input').not(':button, :submit, :reset, :hidden');
// Submit function:
$form.submit(function() {
$.post($(this).attr('action'), $(this).serialize(), function(response) {
// On success, clear all inputs;
$impt.val('').attr('value', '').removeAttr('checked').removeAttr('selected');
// Write a confirmation message:
$conf.html("Form submitted!!");
// Disable the submit button:
$subm.prop('disabled', true);
}, 'json');
return false;
});
});
</script>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<div id="newform">
<form id="myForm" action="the script from Google">
Your name:<br>
<input type="text" name="name" placeholder="your name" style="width:200px"><br> Your phone:<br>
<input type="number" name="phone" placeholder="you phone" style="width:200px"><br> Your email:<br>
<input type="email" name="email" placeholder="your email" style="width:200px"><br> Message:
<br>
<input type="textbox" name="message" placeholder="your message" style="width:200px"><br>
<input type="submit" id="mySubmit" value="submit" onclick="window.location.href = 'https://www.xul.fr/ajax/anotherpage.html';">
</form>
<p><span id="myConf">Submit</span></p>
</div>
</body>
</html>
anyone knows how to embed the "thankyou.html" (or anotherpage.html as seen from the above example) inside the division <div id="newform">
after submitting a form?
javascript html forms redirect
add a comment |
I am a product engineer and new to coding,
but now I am making a portfolio website from a template. I have successfully made a form and transferred the submitted contents to the Google Sheet, but I want to do more.
I want to embed the "thank you page" thankyou.html
inside the existing division <div id="newform">
of my webpage after submit a form. All I know is the code window.location.href
, but it will redirect the entire page to the thank you page, here is my code:
<script src = "//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" >
</script>
<script type = "text/javascript" >
$(document).ready(function() {
// References:
var $form = $('#myForm');
var $conf = $('#myConf');
var $subm = $('#mySubmit');
var $impt = $form.find(':input').not(':button, :submit, :reset, :hidden');
// Submit function:
$form.submit(function() {
$.post($(this).attr('action'), $(this).serialize(), function(response) {
// On success, clear all inputs;
$impt.val('').attr('value', '').removeAttr('checked').removeAttr('selected');
// Write a confirmation message:
$conf.html("Form submitted!!");
// Disable the submit button:
$subm.prop('disabled', true);
}, 'json');
return false;
});
});
</script>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<div id="newform">
<form id="myForm" action="the script from Google">
Your name:<br>
<input type="text" name="name" placeholder="your name" style="width:200px"><br> Your phone:<br>
<input type="number" name="phone" placeholder="you phone" style="width:200px"><br> Your email:<br>
<input type="email" name="email" placeholder="your email" style="width:200px"><br> Message:
<br>
<input type="textbox" name="message" placeholder="your message" style="width:200px"><br>
<input type="submit" id="mySubmit" value="submit" onclick="window.location.href = 'https://www.xul.fr/ajax/anotherpage.html';">
</form>
<p><span id="myConf">Submit</span></p>
</div>
</body>
</html>
anyone knows how to embed the "thankyou.html" (or anotherpage.html as seen from the above example) inside the division <div id="newform">
after submitting a form?
javascript html forms redirect
what you can do is create an iframe and give it path to your thankyou.html and add that iframe into<div id="newform">
and that iframe will render your thankyou.html page. (you can see simple documentation about iframe here: w3schools.com/html/html_iframe.asp)
– Saad Mehmood
Jan 1 at 8:15
I think another alternative would be adding the thankyou.html's HTML content inside the <div> from the very beginning, but setting its display property to none. When the user submits the form successfully, change the display style from none to block.
– Ray Chan
Jan 1 at 8:51
add a comment |
I am a product engineer and new to coding,
but now I am making a portfolio website from a template. I have successfully made a form and transferred the submitted contents to the Google Sheet, but I want to do more.
I want to embed the "thank you page" thankyou.html
inside the existing division <div id="newform">
of my webpage after submit a form. All I know is the code window.location.href
, but it will redirect the entire page to the thank you page, here is my code:
<script src = "//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" >
</script>
<script type = "text/javascript" >
$(document).ready(function() {
// References:
var $form = $('#myForm');
var $conf = $('#myConf');
var $subm = $('#mySubmit');
var $impt = $form.find(':input').not(':button, :submit, :reset, :hidden');
// Submit function:
$form.submit(function() {
$.post($(this).attr('action'), $(this).serialize(), function(response) {
// On success, clear all inputs;
$impt.val('').attr('value', '').removeAttr('checked').removeAttr('selected');
// Write a confirmation message:
$conf.html("Form submitted!!");
// Disable the submit button:
$subm.prop('disabled', true);
}, 'json');
return false;
});
});
</script>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<div id="newform">
<form id="myForm" action="the script from Google">
Your name:<br>
<input type="text" name="name" placeholder="your name" style="width:200px"><br> Your phone:<br>
<input type="number" name="phone" placeholder="you phone" style="width:200px"><br> Your email:<br>
<input type="email" name="email" placeholder="your email" style="width:200px"><br> Message:
<br>
<input type="textbox" name="message" placeholder="your message" style="width:200px"><br>
<input type="submit" id="mySubmit" value="submit" onclick="window.location.href = 'https://www.xul.fr/ajax/anotherpage.html';">
</form>
<p><span id="myConf">Submit</span></p>
</div>
</body>
</html>
anyone knows how to embed the "thankyou.html" (or anotherpage.html as seen from the above example) inside the division <div id="newform">
after submitting a form?
javascript html forms redirect
I am a product engineer and new to coding,
but now I am making a portfolio website from a template. I have successfully made a form and transferred the submitted contents to the Google Sheet, but I want to do more.
I want to embed the "thank you page" thankyou.html
inside the existing division <div id="newform">
of my webpage after submit a form. All I know is the code window.location.href
, but it will redirect the entire page to the thank you page, here is my code:
<script src = "//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" >
</script>
<script type = "text/javascript" >
$(document).ready(function() {
// References:
var $form = $('#myForm');
var $conf = $('#myConf');
var $subm = $('#mySubmit');
var $impt = $form.find(':input').not(':button, :submit, :reset, :hidden');
// Submit function:
$form.submit(function() {
$.post($(this).attr('action'), $(this).serialize(), function(response) {
// On success, clear all inputs;
$impt.val('').attr('value', '').removeAttr('checked').removeAttr('selected');
// Write a confirmation message:
$conf.html("Form submitted!!");
// Disable the submit button:
$subm.prop('disabled', true);
}, 'json');
return false;
});
});
</script>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<div id="newform">
<form id="myForm" action="the script from Google">
Your name:<br>
<input type="text" name="name" placeholder="your name" style="width:200px"><br> Your phone:<br>
<input type="number" name="phone" placeholder="you phone" style="width:200px"><br> Your email:<br>
<input type="email" name="email" placeholder="your email" style="width:200px"><br> Message:
<br>
<input type="textbox" name="message" placeholder="your message" style="width:200px"><br>
<input type="submit" id="mySubmit" value="submit" onclick="window.location.href = 'https://www.xul.fr/ajax/anotherpage.html';">
</form>
<p><span id="myConf">Submit</span></p>
</div>
</body>
</html>
anyone knows how to embed the "thankyou.html" (or anotherpage.html as seen from the above example) inside the division <div id="newform">
after submitting a form?
<script src = "//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" >
</script>
<script type = "text/javascript" >
$(document).ready(function() {
// References:
var $form = $('#myForm');
var $conf = $('#myConf');
var $subm = $('#mySubmit');
var $impt = $form.find(':input').not(':button, :submit, :reset, :hidden');
// Submit function:
$form.submit(function() {
$.post($(this).attr('action'), $(this).serialize(), function(response) {
// On success, clear all inputs;
$impt.val('').attr('value', '').removeAttr('checked').removeAttr('selected');
// Write a confirmation message:
$conf.html("Form submitted!!");
// Disable the submit button:
$subm.prop('disabled', true);
}, 'json');
return false;
});
});
</script>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<div id="newform">
<form id="myForm" action="the script from Google">
Your name:<br>
<input type="text" name="name" placeholder="your name" style="width:200px"><br> Your phone:<br>
<input type="number" name="phone" placeholder="you phone" style="width:200px"><br> Your email:<br>
<input type="email" name="email" placeholder="your email" style="width:200px"><br> Message:
<br>
<input type="textbox" name="message" placeholder="your message" style="width:200px"><br>
<input type="submit" id="mySubmit" value="submit" onclick="window.location.href = 'https://www.xul.fr/ajax/anotherpage.html';">
</form>
<p><span id="myConf">Submit</span></p>
</div>
</body>
</html>
<script src = "//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" >
</script>
<script type = "text/javascript" >
$(document).ready(function() {
// References:
var $form = $('#myForm');
var $conf = $('#myConf');
var $subm = $('#mySubmit');
var $impt = $form.find(':input').not(':button, :submit, :reset, :hidden');
// Submit function:
$form.submit(function() {
$.post($(this).attr('action'), $(this).serialize(), function(response) {
// On success, clear all inputs;
$impt.val('').attr('value', '').removeAttr('checked').removeAttr('selected');
// Write a confirmation message:
$conf.html("Form submitted!!");
// Disable the submit button:
$subm.prop('disabled', true);
}, 'json');
return false;
});
});
</script>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<div id="newform">
<form id="myForm" action="the script from Google">
Your name:<br>
<input type="text" name="name" placeholder="your name" style="width:200px"><br> Your phone:<br>
<input type="number" name="phone" placeholder="you phone" style="width:200px"><br> Your email:<br>
<input type="email" name="email" placeholder="your email" style="width:200px"><br> Message:
<br>
<input type="textbox" name="message" placeholder="your message" style="width:200px"><br>
<input type="submit" id="mySubmit" value="submit" onclick="window.location.href = 'https://www.xul.fr/ajax/anotherpage.html';">
</form>
<p><span id="myConf">Submit</span></p>
</div>
</body>
</html>
javascript html forms redirect
javascript html forms redirect
edited Jan 1 at 10:12
Lloyd Nicholson
298110
298110
asked Jan 1 at 7:48
Delay No MoreDelay No More
62
62
what you can do is create an iframe and give it path to your thankyou.html and add that iframe into<div id="newform">
and that iframe will render your thankyou.html page. (you can see simple documentation about iframe here: w3schools.com/html/html_iframe.asp)
– Saad Mehmood
Jan 1 at 8:15
I think another alternative would be adding the thankyou.html's HTML content inside the <div> from the very beginning, but setting its display property to none. When the user submits the form successfully, change the display style from none to block.
– Ray Chan
Jan 1 at 8:51
add a comment |
what you can do is create an iframe and give it path to your thankyou.html and add that iframe into<div id="newform">
and that iframe will render your thankyou.html page. (you can see simple documentation about iframe here: w3schools.com/html/html_iframe.asp)
– Saad Mehmood
Jan 1 at 8:15
I think another alternative would be adding the thankyou.html's HTML content inside the <div> from the very beginning, but setting its display property to none. When the user submits the form successfully, change the display style from none to block.
– Ray Chan
Jan 1 at 8:51
what you can do is create an iframe and give it path to your thankyou.html and add that iframe into
<div id="newform">
and that iframe will render your thankyou.html page. (you can see simple documentation about iframe here: w3schools.com/html/html_iframe.asp)– Saad Mehmood
Jan 1 at 8:15
what you can do is create an iframe and give it path to your thankyou.html and add that iframe into
<div id="newform">
and that iframe will render your thankyou.html page. (you can see simple documentation about iframe here: w3schools.com/html/html_iframe.asp)– Saad Mehmood
Jan 1 at 8:15
I think another alternative would be adding the thankyou.html's HTML content inside the <div> from the very beginning, but setting its display property to none. When the user submits the form successfully, change the display style from none to block.
– Ray Chan
Jan 1 at 8:51
I think another alternative would be adding the thankyou.html's HTML content inside the <div> from the very beginning, but setting its display property to none. When the user submits the form successfully, change the display style from none to block.
– Ray Chan
Jan 1 at 8:51
add a comment |
2 Answers
2
active
oldest
votes
Add this above the }, 'json');
line:
$('#newform').append('<iframe src="/thankyou.html" name="frame1" id="frame1"></iframe>');
Thank you for your help, i have added. The new iframe will appear below the form after submittion. It is possible to replace the entire form (inside <div id="newform">) with the thankyou.html after submit?
– Delay No More
Jan 1 at 8:48
There are many ways. You can: 1) Replace the line I wrote with this:$('body').append('<iframe src="/thankyou.html" name="frame1" id="frame1"></iframe>');
and 2) Add this line above it:$('#newform'').hide();
.
– ram1
Jan 1 at 8:55
1
Or you can use jQuery's replaceWith method.$('#myForm').replaceWith('Your thankyou.html content');
You can read more from jQuery's doc
– Ray Chan
Jan 1 at 8:57
Yes that is better. I forgot aboutreplaceWith
.
– ram1
Jan 1 at 9:11
add a comment |
Thank you all the friends here, the code replaceWith really works for me, here is the answer to my question:
$('#myForm').replaceWith('<iframe src="https://www.example.com/thankyou.html" name="thankyouframe" id="thankyouframe"></iframe>');
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53993860%2fdisplay-the-content-inside-a-division-from-another-page-after-submitting-a-form%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Add this above the }, 'json');
line:
$('#newform').append('<iframe src="/thankyou.html" name="frame1" id="frame1"></iframe>');
Thank you for your help, i have added. The new iframe will appear below the form after submittion. It is possible to replace the entire form (inside <div id="newform">) with the thankyou.html after submit?
– Delay No More
Jan 1 at 8:48
There are many ways. You can: 1) Replace the line I wrote with this:$('body').append('<iframe src="/thankyou.html" name="frame1" id="frame1"></iframe>');
and 2) Add this line above it:$('#newform'').hide();
.
– ram1
Jan 1 at 8:55
1
Or you can use jQuery's replaceWith method.$('#myForm').replaceWith('Your thankyou.html content');
You can read more from jQuery's doc
– Ray Chan
Jan 1 at 8:57
Yes that is better. I forgot aboutreplaceWith
.
– ram1
Jan 1 at 9:11
add a comment |
Add this above the }, 'json');
line:
$('#newform').append('<iframe src="/thankyou.html" name="frame1" id="frame1"></iframe>');
Thank you for your help, i have added. The new iframe will appear below the form after submittion. It is possible to replace the entire form (inside <div id="newform">) with the thankyou.html after submit?
– Delay No More
Jan 1 at 8:48
There are many ways. You can: 1) Replace the line I wrote with this:$('body').append('<iframe src="/thankyou.html" name="frame1" id="frame1"></iframe>');
and 2) Add this line above it:$('#newform'').hide();
.
– ram1
Jan 1 at 8:55
1
Or you can use jQuery's replaceWith method.$('#myForm').replaceWith('Your thankyou.html content');
You can read more from jQuery's doc
– Ray Chan
Jan 1 at 8:57
Yes that is better. I forgot aboutreplaceWith
.
– ram1
Jan 1 at 9:11
add a comment |
Add this above the }, 'json');
line:
$('#newform').append('<iframe src="/thankyou.html" name="frame1" id="frame1"></iframe>');
Add this above the }, 'json');
line:
$('#newform').append('<iframe src="/thankyou.html" name="frame1" id="frame1"></iframe>');
answered Jan 1 at 8:19
ram1ram1
3,10953138
3,10953138
Thank you for your help, i have added. The new iframe will appear below the form after submittion. It is possible to replace the entire form (inside <div id="newform">) with the thankyou.html after submit?
– Delay No More
Jan 1 at 8:48
There are many ways. You can: 1) Replace the line I wrote with this:$('body').append('<iframe src="/thankyou.html" name="frame1" id="frame1"></iframe>');
and 2) Add this line above it:$('#newform'').hide();
.
– ram1
Jan 1 at 8:55
1
Or you can use jQuery's replaceWith method.$('#myForm').replaceWith('Your thankyou.html content');
You can read more from jQuery's doc
– Ray Chan
Jan 1 at 8:57
Yes that is better. I forgot aboutreplaceWith
.
– ram1
Jan 1 at 9:11
add a comment |
Thank you for your help, i have added. The new iframe will appear below the form after submittion. It is possible to replace the entire form (inside <div id="newform">) with the thankyou.html after submit?
– Delay No More
Jan 1 at 8:48
There are many ways. You can: 1) Replace the line I wrote with this:$('body').append('<iframe src="/thankyou.html" name="frame1" id="frame1"></iframe>');
and 2) Add this line above it:$('#newform'').hide();
.
– ram1
Jan 1 at 8:55
1
Or you can use jQuery's replaceWith method.$('#myForm').replaceWith('Your thankyou.html content');
You can read more from jQuery's doc
– Ray Chan
Jan 1 at 8:57
Yes that is better. I forgot aboutreplaceWith
.
– ram1
Jan 1 at 9:11
Thank you for your help, i have added. The new iframe will appear below the form after submittion. It is possible to replace the entire form (inside <div id="newform">) with the thankyou.html after submit?
– Delay No More
Jan 1 at 8:48
Thank you for your help, i have added. The new iframe will appear below the form after submittion. It is possible to replace the entire form (inside <div id="newform">) with the thankyou.html after submit?
– Delay No More
Jan 1 at 8:48
There are many ways. You can: 1) Replace the line I wrote with this:
$('body').append('<iframe src="/thankyou.html" name="frame1" id="frame1"></iframe>');
and 2) Add this line above it: $('#newform'').hide();
.– ram1
Jan 1 at 8:55
There are many ways. You can: 1) Replace the line I wrote with this:
$('body').append('<iframe src="/thankyou.html" name="frame1" id="frame1"></iframe>');
and 2) Add this line above it: $('#newform'').hide();
.– ram1
Jan 1 at 8:55
1
1
Or you can use jQuery's replaceWith method.
$('#myForm').replaceWith('Your thankyou.html content');
You can read more from jQuery's doc– Ray Chan
Jan 1 at 8:57
Or you can use jQuery's replaceWith method.
$('#myForm').replaceWith('Your thankyou.html content');
You can read more from jQuery's doc– Ray Chan
Jan 1 at 8:57
Yes that is better. I forgot about
replaceWith
.– ram1
Jan 1 at 9:11
Yes that is better. I forgot about
replaceWith
.– ram1
Jan 1 at 9:11
add a comment |
Thank you all the friends here, the code replaceWith really works for me, here is the answer to my question:
$('#myForm').replaceWith('<iframe src="https://www.example.com/thankyou.html" name="thankyouframe" id="thankyouframe"></iframe>');
add a comment |
Thank you all the friends here, the code replaceWith really works for me, here is the answer to my question:
$('#myForm').replaceWith('<iframe src="https://www.example.com/thankyou.html" name="thankyouframe" id="thankyouframe"></iframe>');
add a comment |
Thank you all the friends here, the code replaceWith really works for me, here is the answer to my question:
$('#myForm').replaceWith('<iframe src="https://www.example.com/thankyou.html" name="thankyouframe" id="thankyouframe"></iframe>');
Thank you all the friends here, the code replaceWith really works for me, here is the answer to my question:
$('#myForm').replaceWith('<iframe src="https://www.example.com/thankyou.html" name="thankyouframe" id="thankyouframe"></iframe>');
answered Jan 1 at 9:32
Delay No MoreDelay No More
62
62
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53993860%2fdisplay-the-content-inside-a-division-from-another-page-after-submitting-a-form%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
what you can do is create an iframe and give it path to your thankyou.html and add that iframe into
<div id="newform">
and that iframe will render your thankyou.html page. (you can see simple documentation about iframe here: w3schools.com/html/html_iframe.asp)– Saad Mehmood
Jan 1 at 8:15
I think another alternative would be adding the thankyou.html's HTML content inside the <div> from the very beginning, but setting its display property to none. When the user submits the form successfully, change the display style from none to block.
– Ray Chan
Jan 1 at 8:51