From 6b51fd57adcfe67ac4ad8188458e692d310521e7 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Thu, 27 Jan 2011 06:46:17 -0500 Subject: [PATCH] Conditional Ajax on db Search Remove extra wrapping of jQuery object Avoid extra generation of hidden field Add vim modeline --- db_search.php | 2 +- js/db_search.js | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/db_search.php b/db_search.php index 22415aae0..018587977 100644 --- a/db_search.php +++ b/db_search.php @@ -290,7 +290,7 @@ else { */ ?> -
+ method="post" action="db_search.php" name="db_search">
diff --git a/js/db_search.js b/js/db_search.js index 93daa1f26..ea7280b24 100644 --- a/js/db_search.js +++ b/js/db_search.js @@ -1,3 +1,4 @@ +/* vim: set expandtab sw=4 ts=4 sts=4: */ /** * @fileoverview JavaScript functions used on Database Search page * @name Database Search @@ -25,18 +26,23 @@ $(document).ready(function() { /** * Ajax Event handler for retrieving the result of an SQL Query + * (see $GLOBALS['cfg']['AjaxEnable']) * * @uses PMA_ajaxShowMessage() */ - $("#db_search_form").live('submit', function(event) { + $("#db_search_form.ajax").live('submit', function(event) { event.preventDefault(); PMA_ajaxShowMessage(PMA_messages['strSearching']); - $(this).append(''); + $form = $(this); - $.get($(this).attr('action'), $(this).serialize() + "&submit_search=" + $("#buttonGo").val(), function(data) { + if (! $form.find('input:hidden').is('#ajax_request_hidden')) { + $form.append(''); + } + + $.get($form.attr('action'), $form.serialize() + "&submit_search=" + $("#buttonGo").val(), function(data) { $("#searchresults").html(data); }) // end $.get() }) -}, 'top.frame_content'); // end $(document).ready() \ No newline at end of file +}, 'top.frame_content'); // end $(document).ready()