Skip to content

Instantly share code, notes, and snippets.

@RafaelFunchal
Last active February 16, 2018 21:54
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save RafaelFunchal/519297c8a79cb5cd88d8 to your computer and use it in GitHub Desktop.
Save RafaelFunchal/519297c8a79cb5cd88d8 to your computer and use it in GitHub Desktop.
Redirects to a custom link after submits the subscription form
<script>
(function($){
$(document).ready(function(){
$( 'form.widget_wysija' ).submit(function(e){
e.preventDefault();
setTimeout(function() {
var msg = $( '.wysija-msg' );
if( msg.text() !== '' ){
window.location.replace( 'http://your_thank_you_page_url' );
}
}, 3000);
});
});
})(window.jQuery);
</script>
@kgjerstad
Copy link

Insert this script below wp_footer() on the theme's footer.php

@indranilmailpoet
Copy link

Hi kgjerstad,
This code is having a Hard Coded URL redirection, how to redirect to my desired URL after submits the subscription form ?
Or can we make a change in the MailPoet Plugin itself.
Could you please help me out here ...
Regards
INDRANIL

@camasa
Copy link

camasa commented Dec 29, 2016

Hi, can you help me?
I'm using two forms to subscribe to the same newslleter list. But each one redirects for a differents pages after submission.
Is it possible in this code specify the two forms? Using the if or something like that?
Thank you!

@RafaelFunchal
Copy link
Author

@camasa, check if each form has a different class or id, then edit the element mentioned on line 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment