Redirecting and AJAX - Using Ajax Plugin

A simple AJAX POST with a normal redirect is usually resolved in the RequestHandler to avoid actual redirecting when serving AJAX. It instead returns the redirected content as part of the response. Using the AjaxComponent you can disable that and instead return the redirect URL and its status code to manually use it in your JS/jQuery code.

The AJAX result (from the redirect) will go here

Note: The example above also uses Flash plugin which auto-adds the flash messages as X-Flash header to the response. If you want to keep the flash messages in the payload, you can also disable the header part using `'noSessionOnAjax'` config set to false (see code). Not using header but payload

Send your feedback or bugreport!