Using backbone.js, and I have a form that I am able to submit and after submitting, the savepost() function redirects it to the dashboard url. The dashboard is a different view, and would like that page to say "your post was submitted". I could use localstorage, but do not want to depend on it.
I also see the popular event aggregator options, but not sure if that would work on views being rendered in the a different page.
Sounds like you need a global event bus.
Here's a great example jsfiddle, author is credited in the fiddle
https://jsfiddle.net/JamesOR/m8J9L/
Then, inside the dashboard view, listen for the event. In the fiddle you'll notice the author uses
.on
. This is old style, the backbone author now recommendslistenTo
, because once the view is removed, all listeners are removed automatically. This is not the case withon
Then, when the form is submitted, trigger the event.
In the handler method