I’m trying to establish a cookie upon form submission. How can I ensure the cookie is set on the thank you page when a user submits the form from a different page?
Form exists on http://www.example.com/
Cookie to be creatd on http://www.example.com/thank-you
Below is the code I am currently using
jQuery.ajax({
type: 'POST',
url: actionURL,
data: form.serialize(),
dataType: 'json',
success: function(json) {
window.location.href = "http://www.example.com/";
$.cookie("newcookie", "new", { path: "/thank-you", expires: 365 });
}
})
1