JSFiddle - React, Tailwind, and code Playground
by JonNorman
HTML
JavaScript
function ajaxError(request, type, errorThrown)
{
var message = "There was an error with the AJAX request.\n";
switch (type) {
case 'timeout':
message += "The request timed out.";
break;
case 'notmodified':
message += "The request was not modified but was not retrieved from the cache.";
break;
case 'parseerror':
message += "XML/Json format is bad.";
break;
default:
message += "HTTP Error (" + request.status + " " + request.statusText + ").";
}
message += "\n";
alert(message);
}
$(document).ready(function() {
$.ajax({
//url: 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js',
url:'http://www.yahoo.com/someFileThatDoesNotExist',
dataType: 'script',
accepts:"*",
//async: false,
cache: false,
error: ajaxError,
mimeType: "text/plain",
abort: function() {
alert("aborted")
},
success: function() {
alert("success");
},
xhrFields: {
withCredentials: false
},
scriptCharset: "UTF-8"
});
});