Hi,
I've got jquery sending an AJAX request that executes some checks and then should EITHER redirect to another page or return data. Everything works fine except I'm unable to force the redirect in my actions file. I've tried:
$this->redirect('@new_page'); // DOESN'T WORK
And...
$this->context->getController()->redirect('@new_page'); // DOESN'T WORK
I think there's a way to return the redirect URL back to Jquery and redirect from there but I'd prefer to handle the redirect in my action.
Is this possible?
Thanks
UPDATE:
The final working solution the above was to return TRUE/FALSE back to the Ajax request and add the following to my Jquery function:
if(data == true) window.location.href = "<?php echo url_for('@new_page') ?>";
else // do other stuff
The new page URL didn't need to be dynamic and was able to be inserted on first page load. In this case, TRUE/FALSE sufficed for the data to be returned for the else clause.