拥有多个JQuery函数

时间:2013-10-29 18:57:37

标签: jquery

根据我在另一个上面的JQuery函数中的哪一个,底部的那个断开。我想知道是否有人会知道为什么?有什么东西不能被称为不止一次吗?我不是一个强大的程序员,任何帮助都表示赞赏。

$( "#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 Static Form": function() {
      clearForm($(".statform"));

    },
    "Create Static 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);
          }

        });
      }
    }
  }
}); 

0 个答案:

没有答案