From 8f2546271cff3a91434cefbc77f9cf56d5e42168 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sun, 19 Sep 2010 12:28:14 -0400 Subject: [PATCH] display message when search returns zero rows --- js/tbl_select.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/js/tbl_select.js b/js/tbl_select.js index 95c60a8864..f7bd2720bf 100644 --- a/js/tbl_select.js +++ b/js/tbl_select.js @@ -1,3 +1,4 @@ +/* vim: set expandtab sw=4 ts=4 sts=4: */ /** * @fileoverview JavaScript functions used on tbl_select.php * @@ -27,17 +28,25 @@ $(document).ready(function() { * @uses PMA_ajaxShowMessage() */ $("#tbl_search_form").live('submit', function(event) { + // jQuery object to reuse + $search_form = $(this); event.preventDefault(); PMA_ajaxShowMessage(PMA_messages['strSearching']); - // add this hidden field just once - if (! $(this).find('input:hidden').is('#ajax_request_hidden')) { - $(this).append(''); - } + // add this hidden field just once + if (! $search_form.find('input:hidden').is('#ajax_request_hidden')) { + $search_form.append(''); + } - $.post($(this).attr('action'), $(this).serialize(), function(data) { - $("#searchresults").html(data); + $.post($search_form.attr('action'), $search_form.serialize(), function(response) { + if (typeof response == 'string') { + // found results + $("#searchresults").html(response); + } else { + // error message (zero rows) + $("#searchresults").html(response['message']); + } }) }) }, 'top.frame_content'); // end $(document).ready() -- 2.11.4.GIT