Cleans up and simplifies code shared by ajaxPrefilter and ajaxTransport. Removes chainability of ajaxSetup, ajaxPrefilter and ajaxTransport. Also makes sure context is handled properly by ajaxSetup (unit test added).

This commit is contained in:
jaubourg 2011-01-20 04:12:15 +01:00
parent 96b00a4935
commit 64e1cdbb95
4 changed files with 139 additions and 114 deletions

View file

@ -9,10 +9,11 @@ jQuery.ajaxSetup({
jsonpCallback: function() {
return "jsonp" + jsc++;
}
});
// Detect, normalize options and install callbacks for jsonp requests
// (dataIsString is used internally)
}).ajaxPrefilter("json jsonp", function(s, originalSettings, dataIsString) {
jQuery.ajaxPrefilter("json jsonp", function(s, originalSettings, dataIsString) {
dataIsString = ( typeof(s.data) === "string" );