I have absolutely no idea how to add a 'thank you page' submission to my clients website. I am not experienced in coding, only UI etc.
Here is a [link][1] to site in question.
( EDIT ) Let me elaborate. I am using Blocs (bootstrap wysiwyg app) and there is a form submit. I now need to add a 'thank-you' page redirect for google analytics purposes. The code below is what I believe will be able to help:
$(function()
{ var successMsg = "Your message has been sent."; // Message shown on success. var failMsg = "Sorry it seems that our mail server is not responding, Sorry for the inconvenience!"; // Message shown on fail.
$("input,textarea").jqBootstrapValidation(
{
preventSubmit: true,
submitSuccess: function($form, event)
{
if(!$form.attr('action')) // Check form doesnt have action attribute
{
event.preventDefault(); // prevent default submit behaviour
var processorFile = "./includes/"+$form.attr('id')+".php";
var formData = {};
$form.find("input, textarea, option:selected").each(function(e) // Loop over form objects build data object
{
var fieldData = $(this).val();
var fieldID = $(this).attr('id');
if($(this).is(':checkbox')) // Handle Checkboxes
{
fieldData = $(this).is(":checked");
}
else if($(this).is(':radio')) // Handle Radios
{
fieldData = $(this).val()+' = '+$(this).is(":checked");
}
else if($(this).is('option:selected')) // Handle Option Selects
{
fieldID = $(this).parent().attr('id');
}
formData[fieldID] = fieldData;
});
First, submit the form and then catch the post. Handle the form and redirect.
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Handle your form
// redirect
header("Location: thank-you.php");
exit;
}
?>
<form metod="POST" action="<?= $_SERVER['REQUEST_URI']; ?>">
<button type="submit">Send</button>
</form>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.