Redirect to new url

Yup.

Unless I am missing something obvious, this should work as I described.
Here’s a modified version of the page you linked to. The form requires you to enter a valid email address. Once you have and you press submit, you are redirected to example.com

Is this not what you are trying to achieve?

I’m sorry, maybe I didn’t explain myself clearly enough. The form I’m using is generated by the MailPoet newsletter plugin which also collects and processes the submitted form data. If I change the designated action url the plugin will no longer work as intended.

Thanks, this is the info that was missing.
So, I’m still in the dark as to what you are trying to achieve.
Could you summarize your problem again?

After successfully submitting their details I would like users to be redirected to a “thank you” page.

It appears that MailPoet adds a custom post type to your site that is used to show the confirmation page.

Here’s a detailed (and more importantly, recent) description of how to customize it: http://support.mailpoet.com/knowledgebase/customize-your-confirmation-pages/

That won’t work either. Those pages are for when someone either confirms their subscription or unsubscribes. Actually, I’ve contacted MailPoet about this already and they said that currently the only way to do it is by using a script but an option would be included in the next release. It was when I tried using the script and found it wasn’t working that I posted my question here.

So we’re back to square one.
Does the link you provided in post#10 include all relevant plugins, or is there something missing?

Yes, back to square one but I haven’t quite lost hope yet! Everything is set up and ready to go on that page. I just have to add some content once I get the form working.

I had a look at the code on the page you link to:

(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);

This won’t work, as you don’t have a form with a class name of widget_wysija and you don’t have an element with a class name of .wysija-msg

The jQuery vs $ point is moot, as you pass the function a reference to jQuery which you then alias to the dollar variable.

So, any suggestions how to get it to work?

Well you need a way to check if the form has been filled out correctly.
What are you using for the form validation?
Where is that alert coming from if I enter an incorrect email address?

The alert is coming from the List Fusion plugin I’m using to display the form.

Ok, well you need to hook into that and ascertain that the form has no errors in which case you’re good to redirect.

e.g.

$('#listfusion-submit-btn').click(function(e) {
  ...
  if( !emailReg.test( emailaddressVal.replace(/^\s+|\s+$/g,"") ) ) {
    alert('- Valid Email Required.');
    $('#'+listfusion_item_squeezepg.emailFldID).focus();

   ---> set some kind of flag here <---

    return false;
  } else {
    if( listfusion_item_squeezepg.addCSV != 2 ) {
      listfusion_set_sqpg_cookie(listfusion_item_squeezepg.clickIDName,listfusion_item_squeezepg.displayItemID,'1');
    }
    if( listfusion_item_squeezepg.addCSV == 1 ) { 
      listfusion_set_sqpg_cookie('itemcsv-'+itemID,globalcsv,'1'); 
    }

    // return true;	<-- don't do this, rather: 
   if (thereAreNoErrors){ 
    REDIRECT
   }
  }
});

Ok, maybe we’re getting somewhere but I take it this still needs some editing to turn it into a working script? Unfortunately, I just don’t have enough knowledge of Javascript to do that.

I just went through this again and this approach really works for me.
What happens when you specify the url in the form’s action attribute?
What doesn’t work?
Can you post an example of this not working?

There’s an action url field in the List Fusion plugin settings but after entering the url of my “thank you” page the page source shows the action url as empty.

Ah ok, so the plugin does weird things with the action attribute.

In that case, as the validation returns true if no errors are present, try adding this to the end of the page:

<script>
  jQuery("form").on("submit", function(){
    window.location.replace( 'http://your_thank_you_page_url' );
  });
</script>

If that doesn’t work, I’ll have a look at the other file when I get back from work, but this would be a cleaner solution.

I thought that would work too but it doesn’t. Should I have it in the footer?

You should have it after the form is rendered, so, yeah, at the bottom would be best.
Can you also update your demo page, so I can see it not working?

The demo page has been updated already.