From 694c1db00f511b5d4de5a5fe85177db4e8d9d484 Mon Sep 17 00:00:00 2001 From: whittet Date: Fri, 18 Feb 2011 11:18:40 -0800 Subject: [PATCH] Problem: $.ajax override prevents JSON POST via jqgrid plugin. Solution: Please review code change and rerun your unit tests. Analysis of your code appears to suggest that this method is not responsible for altering the settings. Therefore, I changed the behavior to get the settings to a local variable. This is a serious issue as I believe it breaks jqgrid. At least for my use case using JSON/POST. --- jquery.validate.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/jquery.validate.js b/jquery.validate.js index d840eabd6..03aa00a16 100644 --- a/jquery.validate.js +++ b/jquery.validate.js @@ -1082,6 +1082,9 @@ $.format = $.validator.format; })(jQuery); +// ajax mode: abort +// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]}); +// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort() // ajax mode: abort // usage: $.ajax({ mode: "abort"[, port: "uniqueport"]}); // if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort() @@ -1089,10 +1092,10 @@ $.format = $.validator.format; var ajax = $.ajax; var pendingRequests = {}; $.ajax = function(settings) { - // create settings for compatibility with ajaxSetup - settings = $.extend(settings, $.extend({}, $.ajaxSettings, settings)); - var port = settings.port; - if (settings.mode == "abort") { + // get read-only settings for compatibility with ajaxSetup + var localSettings = $.extend({}, $.ajaxSettings, settings); + var port = localSettings.port; + if (localSettings.mode == "abort") { if ( pendingRequests[port] ) { pendingRequests[port].abort(); }