Add "loaded" event to modals that use "remote"

Fixes issue #5169. Uses the callback in jQuery's .load() to trigger a
"loaded" event on the modal element.