makeAjaxRequest: log all errors, test callback

* All AJAX errors will log to the console
* The onError callback will only be called if defined