JSFiddle - React, Tailwind, and code Playground
JavaScript
$.ajax({
url: 'http://ip.jsontest.com/',
dataType: 'text',
type: 'GET',
async: true,
statusCode: {
404: function (response) {
alert(404);
},
200: function (response) {
alert(response);
}
},
error: function (jqXHR, status, errorThrown) {
alert('error');
}
});