Reputation: 629
I send an ajax request on page1 and when I return a response, I do a redirect on a client via javascript on page2. What I want is to show a flash on a page2. Just "put_flash("something")" doesn't work because I can only call it from an action I return an ajax response from on page1. Whereas I want to show flash on page2 where I get redirected by javascript code. How can I do that?
Upvotes: 1
Views: 305
Reputation: 4804
My understanding of how flash works (mainly from the Rails world, but I had no reason to think Phoenix handled it differently) is this:
Note: If the subsequent request to the server is an AJAX request that returns JSON, I don't know exactly what will happen to the flash content in this case. My guess is that when constructing your JSON response, you can check the flash and include a message if present, just like you do when constructing an HTML response.
Upvotes: 1