Change hook to fire AJAX callbacks

Move AJAX callbacks in line before the capsule_gatekeeper() function hits. Avoids errors adding a capsule server to a local capsule environment.