Publisher is EE6 compatible, but it does not support the Fluid field. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: AJAX Error on form submissions I get 302 Moved Temporarily

Status Resolved
Add-on / Version Custom System Messages
Severity Critical
EE Version

Jubair Saidi

Apr 25, 2012

test for your self (use firebug):
http://www.p3in.com/contact

on error it works fine.  but on success it gives the following error:
AJAX Error
The response was not a valid JSON object.

the email does get sent though and all works as it should except for the redirect.

should be noted that this is happening for all my forms.

also I just tried to upload images but it’s not letting me.  let me know an email address and I can send you screenshots.

#1

Jubair Saidi

Apr 26, 2012

ok so I think I found the bug.

it’s associated with the setting:
“Bypass the message template entirely on successful actions?”

basically if this is set to no, then on successful submit of the form it displays the thank you in the response container space and then forwards on to the final destination.  however if it’s set to Yes, then the above error is what happens.  basically what it looks like is happening is that on success it’s returning the actual return page while it’s expecting a json object so the error is then thrown.

#2

BoldMinded (Brian)

Apr 26, 2012

Ah, I see. Go to ext.system_messages.php line 211 or so and you will see a conditional. Add the last line to it so it looks like this:

if(
            isset($settings['bypass_success']) AND $settings['bypass_success'] == 'y' AND 
            isset($data['redirect']) AND $data['redirect'] != '' AND
            $data['redirect'] != $data['referrer'] 
            AND ! $this->EE->input->is_ajax_request()
        ){

See if that works.

#3

Brian Litzinger

Apr 26, 2012

I added this fix to 2.4.1 which I’ll push soon.

Login to reply