Conditional Ajax on db Search
Remove extra wrapping of jQuery object Avoid extra generation of hidden field Add vim modeline
This commit is contained in:
@@ -290,7 +290,7 @@ else {
|
|||||||
*/
|
*/
|
||||||
?>
|
?>
|
||||||
<a name="db_search"></a>
|
<a name="db_search"></a>
|
||||||
<form id="db_search_form" method="post" action="db_search.php" name="db_search">
|
<form id="db_search_form"<?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : ''); ?> method="post" action="db_search.php" name="db_search">
|
||||||
<?php echo PMA_generate_common_hidden_inputs($GLOBALS['db']); ?>
|
<?php echo PMA_generate_common_hidden_inputs($GLOBALS['db']); ?>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend><?php echo __('Search in database'); ?></legend>
|
<legend><?php echo __('Search in database'); ?></legend>
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||||
/**
|
/**
|
||||||
* @fileoverview JavaScript functions used on Database Search page
|
* @fileoverview JavaScript functions used on Database Search page
|
||||||
* @name Database Search
|
* @name Database Search
|
||||||
@@ -25,18 +26,23 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Ajax Event handler for retrieving the result of an SQL Query
|
* Ajax Event handler for retrieving the result of an SQL Query
|
||||||
|
* (see $GLOBALS['cfg']['AjaxEnable'])
|
||||||
*
|
*
|
||||||
* @uses PMA_ajaxShowMessage()
|
* @uses PMA_ajaxShowMessage()
|
||||||
*/
|
*/
|
||||||
$("#db_search_form").live('submit', function(event) {
|
$("#db_search_form.ajax").live('submit', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
PMA_ajaxShowMessage(PMA_messages['strSearching']);
|
PMA_ajaxShowMessage(PMA_messages['strSearching']);
|
||||||
|
|
||||||
$(this).append('<input type="hidden" name="ajax_request" value="true">');
|
$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('<input type="hidden" id="ajax_request_hidden" name="ajax_request" value="true" />');
|
||||||
|
}
|
||||||
|
|
||||||
|
$.get($form.attr('action'), $form.serialize() + "&submit_search=" + $("#buttonGo").val(), function(data) {
|
||||||
$("#searchresults").html(data);
|
$("#searchresults").html(data);
|
||||||
}) // end $.get()
|
}) // end $.get()
|
||||||
})
|
})
|
||||||
}, 'top.frame_content'); // end $(document).ready()
|
}, 'top.frame_content'); // end $(document).ready()
|
||||||
|
Reference in New Issue
Block a user