[feature/ajax] Bind to form.submit instead of form input.click

PHPBB3-10270
This commit is contained in:
Igor Wiedler 2012-02-14 16:51:26 +01:00
parent b8a6a50f5c
commit 4848d6c9e8

View file

@ -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