JSFiddle - React, Tailwind, and code Playground
JavaScript
// JSONP error callback: timeout example
$.ajax({
url: 'http://www.google.com',
dataType: 'jsonp',
timeout: 10,
error: function() {
alert('REQUEST 1 (timeout) - An error occured: ' + JSON.stringify(arguments));
}
});
// JSONP error callback: parsererror example
$.ajax({
url: 'http://www.google.com',
dataType: 'jsonp',
error: function() {
alert('REQUEST 2 (parsererror) - An error occured: ' + JSON.stringify(arguments));
}
});
// This will not fire when JSONP error handlers are called
$(document).ajaxError(function() {
alert('GLOBAL ERROR - An error occured: ' + JSON.stringify(arguments));
});