Last active
April 22, 2016 07:08
-
-
Save monkeym4ster/091a26d6d75d3c5feecbc58b27b48621 to your computer and use it in GitHub Desktop.
jQuery ajax add delete/put function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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