Skip to content

Instantly share code, notes, and snippets.

@monkeym4ster
Last active April 22, 2016 07:08
Show Gist options
  • Save monkeym4ster/091a26d6d75d3c5feecbc58b27b48621 to your computer and use it in GitHub Desktop.
Save monkeym4ster/091a26d6d75d3c5feecbc58b27b48621 to your computer and use it in GitHub Desktop.
jQuery ajax add delete/put function
jQuery.each(['put', 'delete'], function(i, method) {
jQuery[method] = function(url, data, callback, type) {
if (jQuery.isFunction(data)) {
type = type || callback;
callback = data;
data = void 0;
}
return jQuery.ajax({
url: url,
type: method,
dataType: type,
data: data,
success: callback
});
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment