ActionController: cleanup postDispatch

Make XHR handling more readable, move module-related stuff to the
module controller
ActionController: create postDispatchXhr

Moved XHR-specific stuff to a dedicated post-dispatch function