Created
February 8, 2011 10:17
-
-
Save dagda1/816227 to your computer and use it in GitHub Desktop.
jquery 1.5 ajax
This file contains 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
function getJSONObject(url, params, ajaxCallBack, ajaxErrorHandler, excludeProgress){ | |
var e = (ajaxErrorHandler) ? ajaxErrorHandler : validationErrorCallBack; | |
var s = (ajaxCallBack) ? ajaxCallBack : jsonCallBack; | |
if (!excludeProgress) | |
$('#working').show(); | |
$.ajax({ | |
type: "POST", | |
url: url, | |
cache: false, | |
data: params, | |
beforeSend: function(xhr) { | |
xhr.setRequestHeader("Ajax", "true"); | |
xhr.setRequestHeader("UseAjaxError", "true"); | |
}, | |
complete: function() { | |
if (!excludeProgress) { | |
stopWorking(); | |
$('#working').hide(); | |
} | |
}, | |
success: s, | |
timeout: _ajaxTimeOut, | |
dataType: "text json", | |
jsonp: null, | |
jsonpCallback: null, | |
error: e | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment