remove unneeded wrapper for jQuery objects; do not generate ajax_request hidden field more than once

This commit is contained in:
Marc Delisle
2010-11-09 07:55:55 -05:00
parent f7169036bc
commit b43375b735

View File

@@ -1671,12 +1671,14 @@ $(document).ready(function() {
/** /**
* @var the_form object referring to the create table form * @var the_form object referring to the create table form
*/ */
var the_form = $("#create_table_form"); var $form = $("#create_table_form");
PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']); PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
$(the_form).append('<input type="hidden" name="ajax_request" value="true" />'); if (! $form.find('input:hidden').is('#ajax_request_hidden')) {
$form.append('<input type="hidden" id="ajax_request_hidden" name="ajax_request" value="true" />');
}
//User wants to submit the form //User wants to submit the form
$.post($(the_form).attr('action'), $(the_form).serialize() + "&do_save_data=" + $(this).val(), function(data) { $.post($form.attr('action'), $form.serialize() + "&do_save_data=" + $(this).val(), function(data) {
if(data.success == true) { if(data.success == true) {
PMA_ajaxShowMessage(data.message); PMA_ajaxShowMessage(data.message);
$("#create_table_dialog").dialog("close").remove(); $("#create_table_dialog").dialog("close").remove();
@@ -1749,13 +1751,15 @@ $(document).ready(function() {
/** /**
* @var the_form object referring to the create table form * @var the_form object referring to the create table form
*/ */
var the_form = $("#create_table_form"); var $form = $("#create_table_form");
PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']); PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
$(the_form).append('<input type="hidden" name="ajax_request" value="true" />'); if (! $form.find('input:hidden').is('#ajax_request_hidden')) {
$form.append('<input type="hidden" id="ajax_request_hidden" name="ajax_request" value="true" />');
}
//User wants to add more fields to the table //User wants to add more fields to the table
$.post($(the_form).attr('action'), $(the_form).serialize() + "&submit_num_fields=" + $(this).val(), function(data) { $.post($form.attr('action'), $form.serialize() + "&submit_num_fields=" + $(this).val(), function(data) {
$("#create_table_dialog").html(data); $("#create_table_dialog").html(data);
}) //end $.post() }) //end $.post()