Skip to content

Instantly share code, notes, and snippets.

@malsup
Created November 1, 2010 10:43
Show Gist options
  • Save malsup/657972 to your computer and use it in GitHub Desktop.
Save malsup/657972 to your computer and use it in GitHub Desktop.
jQuery.post duckpunched for error callback
jQuery.post = function( url, data, callback, type, onError ) {
// shift arguments if data argument was omited
if ( jQuery.isFunction( data ) ) {
onError = type;
type = callback;
callback = data;
data = {};
}
return jQuery.ajax({
type: "POST",
url: url,
data: data,
success: callback,
error: onError,
dataType: type
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment