MDL-33680 JavaScript: Use the correct Content-Type for AJAX scripts

The repository_ajax.php script was returning a text/plain Content-Type and
user/selector/search.php was setting the content-type when this should be
handled by with the definition of AJAX_SCRIPT.
MDL-33680 JavaScript: Improve error handling on user selector

Since the previous commit to this issue removes the built-in debugging
tests, I've added these back using the M.core libraries.