jQuery.each( [ ["update", "PATCH"], ["delete", "DELETE"] ], function( i, method ) {
    jQuery[method[0]] = function (url, data, callback, type) {
        if (jQuery.isFunction(data)) {
            type = type || callback;
            callback = data;
            data = undefined;
        } else {
            if (data === undefined) {
                data = {_method: method[1]};
            } else {
                data['_method'] = method[1];
            }
        }

        return jQuery.ajax({
            url: url,
            type: 'post',
            dataType: type,
            data: data,
            success: callback
        });
    };
});