jQuery or Ajax Error Post it
I have an example for posting window.error. I would like to post .ajaxerror like the example below to my logger page/script. I am not sure how to do it.
WINDOW ERROR:
- window.onerror = function (message, url, linenumber) {
-
- if (window.XMLHttpRequest) {
- var xhr = new XMLHttpRequest();
- var scripturl = "Logger";
- var log = "?message=" + " LINE NUMBER: " + linenumber + " MESSAGE: " + message + " LOCATION: " + url + " CLIENT BROWSER INFO: " + window.navigator.userAgent;
- xhr.open("POST", scripturl + log);
- xhr.setRequestHeader("Content-Type", "text/plain;charset=UTF-8");
- xhr.send(log);
- alert(scripturl + log);
- }
- return true;
- }
AJAX ERROR: I would like to post .AjaxError like the example above to my logger page/script. I am not sure how to do it.
- $(document).ajaxError( function (event, jqXHR, ajaxSettings, thrownError) {
- alert('[event:' + event + '], [jqXHR:' + jqXHR + '], [ajaxSettings:' + ajaxSettings + '], [thrownError:' + thrownError + '])');
-
- });