Ask your WordPress questions! Pay money and get answers fast! (more info)

form redirect WordPress

  • REFUND REQUESTED

I'm using a MailPoet form for a squeeze page and need for users to be redirected to a new URL after submitting the form. I have a [[LINK href="https://gist.github.com/rafaelfunchal/519297c8a79cb5cd88d8"]]script[[/LINK]] which is working but it's causing a problem with the response message. Instead of the usual response message which displays after a form submission, I'm getting an error message.
I would like to either correct the error or if that's not possible, remove the response message altogether.

<strong>UPDATE:</strong> The redirect seems to be working in Chrome (latest version at least) without any errors but not in Firefox. However, in Internet Explorer it's not working at all.

<strong>UPDATE:</strong> I modified the script and it's now working in IE, so the only problem I have now is getting it to work in Firefox.

Answers (3)

2014-12-10

Gabriel Reguly answers:

Hi,

Did you tried replacing 'http://your_thank_you_page_url' with your actual page?

Cheers,
Gabriel


jrcollins comments:

I'm sorry, I'm not sure I understand what you mean. Replace what?


Gabriel Reguly comments:

At script code, you need to customize it for your site. :-)


<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>


See <strong> 'http://your_thank_you_page_url' </strong>?

That is a placeholder, you need to put your actual URL there.

Hope this makes sense now :-)


jrcollins comments:

Yes, I know that. I don't think you understood my question. The script is working but is causing an error in the MailPoet response message.


Gabriel Reguly comments:

Ok, then please post the error message from MailPoet....


jrcollins comments:

I'm getting the following error:

Oops! There is a problem with this form:
textStatus:error
errorThrown:
responseText:


Gabriel Reguly comments:

Hmm, the error message is not helpful at all :-(

What does MailPoet support says about it?


jrcollins comments:

I still didn't get a reply from them about it.


Gabriel Reguly comments:

What if you comment out the script?

Does the error message says something useful or it does not show at all?

What is your site URL?


jrcollins comments:

The error message is showing in place of the response message that the MailPoet plugin displays after the form is submitted. You can edit the content of that message in the plugin settings. It seems there is some sort of conflict with the redirect script.
I have someone else working on the site at the moment so it's not accessible right now. I will post it here tomorrow if the problem is still not solved.


Gabriel Reguly comments:

Ok, sounds like a plan.

Hopefuly it will be an easy fix.


jrcollins comments:

Hi, here's the URL: goo.gl/b7fkuF

2014-12-11

Arnav Joy answers:

I am not sure if it will help you or not but please read this

http://stackoverflow.com/questions/3506208/jquery-ajax-cross-domain


jrcollins comments:

Thanks but I'm not sure if that's relevant to my problem or not.

2014-12-11

Hariprasad Vijayan answers:

Hello,

Could you share site URL to check the issue?

Thanks.


jrcollins comments:

I have someone working on it and will post URL here tomorrow if problem is not solved.


jrcollins comments:

Hi, here's the URL: goo.gl/b7fkuF