对话框按钮打破了我的网站

时间:2013-10-08 21:23:17

标签: jquery jquery-ui dialog

我有一个按钮,打开一个对话框(下面代码中的第一个对话框)。我工作得很好。我试过另一个按钮(下面的第二个对话框代码),但它打破了我的网站。我不是一个强大的程序员,如果有人能告诉我我做错了什么,我真的很感激。

$( "#dialog-new" ).dialog({
        resizable: false,
        width: 'auto',
        modal: true,
        fluid: true,
        autoOpen: false,
        buttons: {
            "Clear Form": function() {
      clearForm($("#newapsform"));

    },
            "Create Request": function() {

                if(formIsOkay($("#newapsform")))
                {
                    $.ajax
                    ({  
                      type: "POST",  
                      url: "system/aps2.newrequest.php",  
                      data: $("#newapsform").serialize(),  
                      success: function() 
                        {  
                            $( "#dialog-new" ).dialog( "close" );
                            $("#goodmsg").html("Created photo request successfully!");
                            $('#goodmsgdiv').fadeIn(1500).delay(3000).fadeOut(1500);

                            datatables.fnDraw();
                            searchtables.fnDraw();
                            phototables.fnDraw();
                            clearForm($("#newapsform"));
                        },
          error: function() 
                        {  
                            $( "#dialog-new" ).dialog( "close" );
                            $("#badmsg").html("Could not create request: Use the force next time.");
                            $('#badmsgdiv').fadeIn(1500).delay(3000).fadeOut(1500);
                        }

                    });
                }
            }
        }
    });

$( "#dialog-stat" ).dialog({
  resizable: false,
  width: 'auto',
  modal: true,
  fluid: true,
  autoOpen: false,
  buttons: {
    "Clear Form": function() {
      clearForm($("#statform"));

    },
    "Create Request": function() {

      if(formIsOkay($("#statform")))
      {
        $.ajax
        ({  
          type: "POST",  
          url: "system/aps2.newrequeststatic.php",  
          data: $("#statform").serialize(),  
          success: function() 
          {  
            $( "#dialog-stat" ).dialog( "close" );
            $("#goodmsg").html("Created photo request successfully!");
            $('#goodmsgdiv').fadeIn(1500).delay(3000).fadeOut(1500);

            datatables.fnDraw();
            searchtables.fnDraw();
            phototables.fnDraw();
            clearForm($("#statform"));
          },
          error: function() 
          {  
            $( "#dialog-stat" ).dialog( "close" );
            $("#badmsg").html("Could not create request: Use the force next time.");
            $('#badmsgdiv').fadeIn(1500).delay(3000).fadeOut(1500);
          }

        });
      }
    }
  }
}); 

以下是按钮,下面是实际的HTML。

$("#newrqbtn").button({
  icons: {primary:'ui-icon-circle-plus',secondary:''}
    }).click(function(e) {
  $("#dialog-new").dialog("open");
});

$("#newrqbtnstat").button({
  icons: {primary:'ui-icon-circle-plus',secondary:''}
}).click(function(e) {
  $("#dialog-stat").dialog("open");
});

这是HTML方面。

<button type="button" id="newrqbtnstat" style="margin-bottom: 10px;">New Static Request</button>

0 个答案:

没有答案