Created
November 1, 2010 10:43
-
-
Save malsup/657972 to your computer and use it in GitHub Desktop.
jQuery.post duckpunched for error callback
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.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