JSFiddle - React, Tailwind, and code Playground
JavaScript
jQuery.each( [ "get", "post" ], function( i, method ) {
jQuery[ method ] = function( url, data, callback, type ) {
// shift arguments if data argument was omitted
if ( jQuery.isFunction( data ) ) {
type = type || callback;
callback = data;
data = undefined;
}
// allow for callback to be passed in as last argument
if ( jQuery.isFunction(type) ) {
var tempType = callback;
callback = type;
type = tempType;
}
return jQuery.ajax({
type: method,
url: url,
data: data,
success: callback,
dataType: type
});
};
});