I'm trying to AJAX-ify the Django contact_form app using Django (1.4.2). I want to let Django do the heavy lifting when it comes to validation and template rendering so I can keep my templates consistent and server side. Therefore, I'm returning "partial" template renderings to inject into the DOM as the user submits the form.
It almost works; The form submits, the partial template renders and is returned, validation errors are displayed, etc. However, once the form is valid, the contact_form's view does an http redirect. I've set the success_url
to redirect to just the sent message url.
I expected it to redirect on the server, return the sent message and replace the form with it. However, this only worked correctly in Chrome. In Firefox and IE the entire browser redirects to my sent message url.
Is there any way to get the redirects to only affect the AJAX response and not redirect the entire browser?