From f1c91fd023ad0bbd01a386bca4d8503e0e27df73 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rn=20Zaefferer?= Date: Tue, 5 Dec 2006 22:58:27 +0000 Subject: [PATCH] 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... --- build/test/data/name.php | 2 +- src/ajax/ajax.js | 8 ++++---- src/ajax/ajaxTest.js | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build/test/data/name.php b/build/test/data/name.php index 514d928..d73abc7 100644 --- a/build/test/data/name.php +++ b/build/test/data/name.php @@ -19,7 +19,7 @@ if($name == 'foo') { die(); } $request = apache_request_headers(); -$request = $request['customHeader']; +$request = $request['X-Custom-Header']; if(strlen($request) > 0) { echo $request; die(); diff --git a/src/ajax/ajax.js b/src/ajax/ajax.js index cf6298d..4df372b 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 0a740aa..cbc15ad 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" ); -- 1.7.10.4