X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fajax%2Fajax.js;h=e37632f540924e479d0be776bb79ff237ce473e4;hb=e0c7e6aec4cf55854217d5c0b2c7069ce84a3d12;hp=b6a18f4f244d39b2600248c6e4996b3b6df536f0;hpb=fc84b9db10da2f69a830dbb9aa78b9c214b297ae;p=jquery.git diff --git a/src/ajax/ajax.js b/src/ajax/ajax.js index b6a18f4..e37632f 100644 --- a/src/ajax/ajax.js +++ b/src/ajax/ajax.js @@ -23,6 +23,7 @@ jQuery.fn.extend({ * Load HTML from a remote file and inject it into the DOM. * * Note: Avoid to use this to load scripts, instead use $.getScript. + * IE strips script tags when there aren't any other characters in front of it. * * @example $("#feeds").load("feeds.html"); * @before
@@ -419,6 +420,8 @@ jQuery.extend({ * You can manually abort requests with the XMLHttpRequest's (returned by * all ajax functions) abort() method. * + * Deprecated. Use $.ajaxSetup instead. + * * @example $.ajaxTimeout( 5000 ); * @desc Make all AJAX requests timeout after 5 seconds. * @@ -428,18 +431,31 @@ jQuery.extend({ * @cat AJAX */ ajaxTimeout: function(timeout) { - //jQuery.timeout = timeout; jQuery.ajaxSettings.timeout = timeout; }, + /** + * Setup global settings for AJAX requests. + * + * See $.ajax for a description of all available options. + * + * @example $.ajaxSetup( { + * url: "/xmlhttp/", + * global: false, + * type: "POST" + * } ); + * @desc Sets the defaults for AJAX requests to the url "/xmlhttp/", + * disables global handlers and uses POST instead of GET + * + * @name $.ajaxSetup + * @type undefined + * @param Object settings Key/value pairs for ajax options + * @cat AJAX + */ ajaxSetup: function(settings) { jQuery.extend(jQuery.ajaxSettings, settings); }, - // Last-Modified header cache for next request - lastModified: {}, - - // TODO document me ajaxSettings: { global: true, type: "GET", @@ -448,6 +464,9 @@ jQuery.extend({ processData: true, async: true }, + + // Last-Modified header cache for next request + lastModified: {}, /** * Load a remote page using an HTTP request. @@ -696,6 +715,10 @@ jQuery.extend({ jQuery.handleError(s, xml, null, e); } + // firefox 1.5 doesn't fire statechange for sync requests + if(!s.async) + onreadystatechange(); + // return XMLHttpRequest to allow aborting the request etc. return xml2; },