XF 2.2 ajax:complete & window.location.href

eDaddi

Active member
EDIT: Moved to proper forum

On my dev site I have a template with two forms and JS. The second form does a redirect after the form submits and some ajax stuff happens

Code:
$(document).on('ajax:complete', function(event, xhr, settings){
    var parts = jQuery.parseJSON(xhr.responseText);
    if(parts['status'] != 'ok'){
        if('cartUrl' in parts){
            window.location.href = '/store/cart.php?target=cart&action=add&product_id='+parts['cartUrl'];

Everything works as it should ..... in dev.

When I push it to live the form submits and the page refreshes, for the life of my I can't get it to do the redirect.

The backend does what it's supposed to. I get no errors.

if I throw a alert(parts['cartUrl']); in before the redirect it's getting the data it should.

Exact same template, JS and PHP code in dev & live
 
I realize this likely isn’t the Xenforo way of doing this, just migrated and need this as a patch until I can learn the XF syntax.

I need to post form data to the page listed in the action, which will then return some JSON with an id. That id needs to be appended to a url string and the user sent there. It’s not the same url in the action, it’s on the same domain though

that possible with xf:form ?
 
Top Bottom