From d3d8f3561b833781a3b7735685e1df48d8e7a60a Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rn=20Zaefferer?= Date: Tue, 22 Apr 2008 22:18:11 +0000 Subject: [PATCH] jquery.ajax: fix for beforeSend-cancelling-sideeffects --- src/ajax.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ajax.js b/src/ajax.js index 4b84538df..ca17f4f0d 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -291,8 +291,13 @@ jQuery.extend({ } catch(e){} // Allow custom headers/mimetypes - if ( s.beforeSend && s.beforeSend(xml, s) === false ) + if ( s.beforeSend && s.beforeSend(xml, s) === false ) { + // cleanup active request counter + s.global && jQuery.active--; + // close opended socket + xml.abort(); return false; + } if ( s.global ) jQuery.event.trigger("ajaxSend", [xml, s]); -- 2.39.5