ダイアログボックスを開くボタンがあります(以下のコードの最初のダイアログ)。私は元気に働いています。別のボタン (下の 2 番目のダイアログ コード) を試しましたが、Web サイトが壊れてしまいます。私は強力なコーダーではありません。誰かが私が間違っていることを教えてくれたら、本当に感謝しています。
$( "#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>