Unbreak JavaScript by moving some of the hooks to the post-AJAX function