diff options
author | Igor Wiedler <igor@wiedler.ch> | 2012-02-14 16:51:26 +0100 |
---|---|---|
committer | Igor Wiedler <igor@wiedler.ch> | 2012-03-31 02:09:25 +0200 |
commit | 4848d6c9e839c287de736cf3badac42e859eaa69 (patch) | |
tree | de00378ef93ab768f0349961a33cd3356f8ded3e /phpBB/assets | |
parent | b8a6a50f5c6a1f1f2ebcf9650e3f026561e2b060 (diff) | |
download | forums-4848d6c9e839c287de736cf3badac42e859eaa69.tar forums-4848d6c9e839c287de736cf3badac42e859eaa69.tar.gz forums-4848d6c9e839c287de736cf3badac42e859eaa69.tar.bz2 forums-4848d6c9e839c287de736cf3badac42e859eaa69.tar.xz forums-4848d6c9e839c287de736cf3badac42e859eaa69.zip |
[feature/ajax] Bind to form.submit instead of form input.click
PHPBB3-10270
Diffstat (limited to 'phpBB/assets')
-rw-r--r-- | phpBB/assets/javascript/core.js | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index 2f1a19c682..4300e7056f 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -245,17 +245,13 @@ phpbb.ajaxify = function(options) { var elements = $(options.selector), refresh = options.refresh, callback = options.callback, - is_form = elements.is('form'); + is_form = elements.is('form'), + event_name = is_form ? 'submit' : 'click'; - if (is_form) - { - elements = elements.find('input:submit'); - } - - elements.click(function() { + elements.bind(event_name, function() { var action, data, path, that = this, $this = $(this); - if ($this.attr('data-ajax') == false) + if (!$this.attr('data-ajax')) { return; } @@ -290,7 +286,7 @@ phpbb.ajaxify = function(options) { if (typeof phpbb.ajax_callbacks[callback] === 'function') { - phpbb.ajax_callbacks[callback].call(that, res, (is_form) ? act : null); + phpbb.ajax_callbacks[callback].call(that, res); } // If the server says to refresh the page, check whether the page should |