Open jeremyharris opened 12 years ago
It might be good to create a sort of mini action. Basically, if it's a mini action and an ajax request, just return the flash message. If it's not an ajax request (i.e., no JavaScript or open in new tab) it would act normally, set the flash message, and redirect to the referer.
There are some instances where redirects are sent from within modals when the only reason they are there is to echo out a flash message that can be captured with javascript. They are also there for downgradability, that is, if a user doesn't have javascript they would click a link and be redirected elsewhere after the action completes. These actions don't have views, so they need to go somewhere.
The problem is that while in a modal, the redirect is really not necessary. Often, the desired effect is to close the modal and display a message.
Examples: