I want to flash feedback messages like "An entry has been created successfully" or "You don't have enough permissions to access this item".
I want to avoid embedding these messages straight into views, because they can re-appear, for example, when a user navigates back to the previous page with his browser.
To solve this problem, I have a javascript function that acts like following:
(showFlashMessage(){
// 1. make an ajax request
// 2. retrieve a flash message (if any)
// 3. display the message
})();
This way, the problem of the reappearance of the flash messages is solved. However, by the time the request is made, the flash message has already disappeared. How should I solve this problem?