Documentation for $.ajaxSetup
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Fri, 22 Dec 2006 14:40:46 +0000 (14:40 +0000)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Fri, 22 Dec 2006 14:40:46 +0000 (14:40 +0000)
newandnoteworthy.txt
src/ajax/ajax.js

index d0d6fc5..a62e1a8 100644 (file)
@@ -1,7 +1,7 @@
 New and Noteworthy
 -----------------
 
-1.0.5
+1.0.5/1.1
 -----
  
  - Fixed synchronous requests
@@ -13,6 +13,7 @@ New and Noteworthy
  - Fixed docs for html(): Now mentions that is not available for XML documents
  - Improved docs for blur() and focus(), mentioning the difference between calling the jQuery method and the DOM method
  - Implemented a better error handling for ajax requests. Exceptions caused by dropping connections are now handled, too.
+ - Added global settings for AJAX (in addition to timeout), use $.ajaxSetup() to modify them
 
 1.0.4
 -----
index b6a18f4..c860b63 100644 (file)
@@ -419,6 +419,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 +430,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 +463,9 @@ jQuery.extend({
                processData: true,
                async: true
        },
+       
+       // Last-Modified header cache for next request
+       lastModified: {},
 
        /**
         * Load a remote page using an HTTP request.