diff --git a/public/js/icinga/events.js b/public/js/icinga/events.js index 54b2aaa00..f83c172f6 100644 --- a/public/js/icinga/events.js +++ b/public/js/icinga/events.js @@ -239,10 +239,8 @@ event.stopPropagation(); event.preventDefault(); - icinga.logger.debug('Submitting form: ' + method + ' ' + url, method); - if ($button.length) { - // activate spinner indicator + // Activate spinner if ($button.hasClass('spinner')) { $button.addClass('active'); } @@ -252,6 +250,13 @@ $target = self.getLinkTargetFor($form); } + if (! url) { + // Use the URL of the target container if the form's action is not set + url = $target.closest('.container').data('icinga-url'); + } + + icinga.logger.debug('Submitting form: ' + method + ' ' + url, method); + if (method === 'GET') { var dataObj = $form.serializeObject(); @@ -274,6 +279,7 @@ } } } + icinga.loader.loadUrl(url, $target, data, method); return false;