From 652125281602494388d18e705b3092bb3aead941 Mon Sep 17 00:00:00 2001 From: paul gray Date: Thu, 30 Aug 2012 05:49:55 +0300 Subject: [PATCH] add target node option for html async form response --- src/rails.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/rails.js b/src/rails.js index 8de1faaa..d58e0674 100644 --- a/src/rails.js +++ b/src/rails.js @@ -135,6 +135,8 @@ data.push(button); element.data('ujs:submit-button', null); } + // get target node selector + var target = element.data('target'); } else if (element.is(rails.inputChangeSelector)) { method = element.data('method'); url = element.data('url'); @@ -156,6 +158,7 @@ return rails.fire(element, 'ajax:beforeSend', [xhr, settings]); }, success: function(data, status, xhr) { + if (dataType == 'html' && target) { $(target).html(data); } element.trigger('ajax:success', [data, status, xhr]); }, complete: function(xhr, status) {