JSFiddle - React, Tailwind, and code Playground

HTML

<h1><code>$.post</code> test</h1>
<p>Check out the logs below</p>

CSS

h1 {
    font-size: 28px;
    font-weight: bold;
}

JavaScript

jQuery.each( [ "get", "post" ], function( i, method ) {
    jQuery[ method ] = function( url, data, callback, type ) {
        // shift arguments if data argument was omitted
        // check if data is a function or a string
        if ( jQuery.isFunction( data ) || (data && data.substring) ) {
            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;
        }

        // For this test, let's log the object
        console.log({
            type: method,
            url: url,
            data: data,
            success: callback,
            dataType: type
        });
    };
});

// Frist, let's demonstrate that there's no regression
$.post('url/', {a:'a'}, function(){}, 'json');
$.post('url/', {a:'a'}, function(){});
$.post('url/');
$.post('url/', function(){}, 'json');
$.post('url/', function(){});
        
// Now, let's test with the dataType passed in first:
$.post('url/', {a:'a'}, 'json', function(){});

$.post('url/', 'json', function(){});

$.post('url/', ( new String('json') ), function(){});