diff --git a/js/ajax.js b/js/ajax.js index 559ea998eb..d1579c231e 100644 --- a/js/ajax.js +++ b/js/ajax.js @@ -123,35 +123,63 @@ var AJAX = { AJAX.active = true; } - var url = $(this).attr('href') || $(this).attr('action') + '?' + $(this).serialize(); this._debug && console.log("Loading: " + url); // no need to translate - var $msgbox = PMA_ajaxShowMessage(); + this.$msgbox = PMA_ajaxShowMessage(); $('html, body').animate({scrollTop: 0}, 'fast'); - $.get(url, {'ajax_request': true, 'ajax_page_request': true}, function (data) { - if (data.success) { - PMA_ajaxRemoveMessage($msgbox); - AJAX.scriptHandler.reset(); + var isLink = !! $(this).attr('href') || false; + var url = isLink ? $(this).attr('href') : $(this).attr('action'); + var params = 'ajax_request=true&ajax_page_request=true'; + if (! isLink) { + params += '&' + $(this).serialize(); + } - if (data._menu) { - $('#floating_menubar').html(data._menu) - .children().first().remove(); // Remove duplicate wrapper (TODO: don't send it in the response) - menuPrepare(); - menuResize(); - } + if (isLink) { + $.get(url, params, AJAX.responseHandler); + } else { + $.post(url, params, AJAX.responseHandler); + } + }, - $('body').children().not('#floating_menubar').not('#page_content').not('#selflink').remove(); + $msgbox: null, - $('#page_content').replaceWith("