On my pages I have several different elements that are showing different representations of the underlying data. I have AJAX that will update the data through a PHP page, but I then want to trigger an update of all the different elements so they reflect the changes.
I'm thinking of binding the independent elements to a custom event "PageUpdate" so that if anything changes, a single event can be fired to update all elements.
I want to know if there is a way to automate this so that the custom event is always triggered when other events are triggered? Or would I have to put $.trigger("PageUpdate")
in every other event I want to trigger "PageUpdate"? Additionally, can I filter out based on the events, when this is triggered? Not all events require a full page update.
The goal is to not have to go back and put .trigger()
calls in the old code and to make it so we don't have to remember it for every event going forward.