diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2006-12-05 22:58:27 +0000 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2006-12-05 22:58:27 +0000 |
commit | f1c91fd023ad0bbd01a386bca4d8503e0e27df73 (patch) | |
tree | 68bfd65bfb5fd9667a0c56981abba24191bb2489 /src | |
parent | 47a6a32b27f7af24dec5dc963fa951177a091cd2 (diff) | |
download | jquery-f1c91fd023ad0bbd01a386bca4d8503e0e27df73.tar.gz jquery-f1c91fd023ad0bbd01a386bca4d8503e0e27df73.zip |
Renamed $.ajax's "before"-option to "beforeSend" to prevent conflict with form plugin - may be a good convention to use beforeXXX and afterXXX everytime for callbacks...
Diffstat (limited to 'src')
-rw-r--r-- | src/ajax/ajax.js | 8 | ||||
-rw-r--r-- | src/ajax/ajaxTest.js | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/ajax/ajax.js b/src/ajax/ajax.js index cf6298d84..4df372bfc 100644 --- a/src/ajax/ajax.js +++ b/src/ajax/ajax.js @@ -484,7 +484,7 @@ jQuery.extend({ * (Boolean) async - By default, all requests are send asynchronous (set to true). * If you need synchronous requests, set this option to false. * - * (Function) before - A pre-callback to set custom headers etc., the + * (Function) beforeSend - A pre-callback to set custom headers etc., the * XMLHttpRequest is passed as the only argument. * * @example $.ajax({ @@ -525,7 +525,7 @@ jQuery.extend({ contentType: "application/x-www-form-urlencoded", processData: true, async: true, - before: null + beforeSend: null }, s); // if data available @@ -568,8 +568,8 @@ jQuery.extend({ xml.setRequestHeader("Connection", "close"); // Allow custom headers/mimetypes - if( s.before ) - s.before(xml); + if( s.beforeSend ) + s.beforeSend(xml); // Wait for a response to come back var onreadystatechange = function(isTimeout){ diff --git a/src/ajax/ajaxTest.js b/src/ajax/ajaxTest.js index 0a740aa9b..cbc15add5 100644 --- a/src/ajax/ajaxTest.js +++ b/src/ajax/ajaxTest.js @@ -282,12 +282,12 @@ test("$.ajax - xml: non-namespace elements inside namespaced elements", function test("$.ajax - preprocess", function() { expect(1); stop(); - var customHeader = "value-for-custom-header"; + var customHeader = "value"; $.ajax({ url: "data/name.php", data: {'req': true}, - before: function(xml) { - xml.setRequestHeader('customHeader', customHeader) + beforeSend: function(xml) { + xml.setRequestHeader('X-Custom-Header', customHeader); }, success: function(data) { ok( data == customHeader, "check return value, should be the custom header sent" ); |