JSFiddle - React, Tailwind, and code Playground
JavaScript
jQuery.ajax({
url: '/echo/json/',
data: {
json: '{ "status": "done" }'
},
type: 'post',
dataType: 'json',
statusCode: {
404:function() { alert("404"); },
200:function() { alert("200"); },
201:function() { alert("201"); },
202:function() { alert("202"); }
},
success: function(data) {
alert( "Status: " + data.status );
}
});