From c64ac1f0fbb2ac4d45a4aa6b81dc34e6db9fa9a9 Mon Sep 17 00:00:00 2001 From: Chris Howlett Date: Thu, 18 Nov 2010 12:49:49 +0000 Subject: [PATCH] Amend author --- src/rails.js | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/rails.js b/src/rails.js index 427e0c2..d4144c0 100644 --- a/src/rails.js +++ b/src/rails.js @@ -37,7 +37,7 @@ jQuery(function ($) { * - ajax:failure - is execute in case of error * - ajax:after - is execute every single time at the end of ajax call */ - callRemote: function () { + callRemote: function (e) { var el = this, method = el.attr('method') || el.attr('data-method') || 'GET', url = el.attr('action') || el.attr('href'), @@ -48,6 +48,11 @@ jQuery(function ($) { } else { if (el.triggerAndReturn('ajax:before')) { var data = el.is('form') ? el.serializeArray() : []; + if (e) + { + data.push({name: e.originalEvent.explicitOriginalTarget.name, + value: e.originalEvent.explicitOriginalTarget.value}) + } $.ajax({ url: url, data: data, @@ -92,7 +97,7 @@ jQuery(function ($) { * remote handlers */ $('form[data-remote]').live('submit.rails', function (e) { - $(this).callRemote(); + $(this).callRemote(e); e.preventDefault(); }); -- 1.7.3.1.msysgit.0