2
私は(FullCalendar
を使用して)モーダルで、ボタンのクリックで問題を抱えている実行します。Fullcalendarモーダルボタンをクリックすると、より多くの時間が
私の計画は次のとおりです。イベントの
- クリックし
- モーダル
- 確認はmysqlデータベース内の値を変更する 3つのオプションが表示されます/ごみは、MySQLデータベース内の値を変更する
私が一度だけ試してみるとうまくいく。しかし、私がモーダルを閉じて他のものを開くと、拒否/確認ボタンをクリックすると、もっと多くの時間(2、4 ...)実行されます。 問題は何ですか?
モーダル:
<div id="eventContent" title="Event Details" style="display:none;">
Name: <span id="name"></span><br>
Start: <span id="startTime"></span><br>
End: <span id="endTime"></span><br><br>
<p id="eventInfo"></p>
<button id="confirm_button" type="button">Confirm</button>
<button id="refuse_button" type="button">Refuse</button>
<button type="close_button">Close</button>
</div>
eventRender:
<script>
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: '',
center: 'prev title next',
right: ''
},
events: "http://localhost/calendar_directory/calendar_db_connect.php",
eventRender: function (event, element) {
element.click(function() {
var start = $.fullCalendar.formatDate(event.start, "YYYY-MM-DD");
var end = $.fullCalendar.formatDate(event.end, "YYYY-MM-DD");
$("#name").html(event.title);
$("#startTime").html(start);
$("#endTime").html(end);
$("#eventContent").dialog({modal: true, title: event.title, width: 350});
$("#refuse_button").click(function()
{
var id = event._id;
var confirmed_number = 2;
var decision = confirm("Do you really want to refuse that?");
if (decision)
{
$.ajax({
url: "http://localhost/calendar_directory/confirm_events.php",
data: '&id=' + id + '&confirmed_number=' + confirmed_number,
type: "POST",
success: function (json)
{
console.log(id);
return;
}
});
}
});
$("#confirm_button").click(function()
{
var id = event._id;
var confirmed_number = 1;
var decision = confirm("Do you really want to confirm that?");
if (decision)
{
$.ajax({
url: "http://localhost/calendar_directory/confirm_events.php",
data: '&id=' + id + '&confirmed_number=' + confirmed_number,
type: "POST",
success: function (json) {
console.log("confirmed");
return;
}
});
}
})
});
},
});
});
</script>
確認列ができ:0,1またはクリックイベントに同じハンドラの割り当て
予告:すべてのクリックを繰り返します。 1、モーダルappears->ゴミをクリックしてください - > OK-> 2 、近くに、モーダルappears->ゴミをクリックして拒否 - > - > OK->拒否ゴミOK->クローズ、 3、モーダルappears->クリックごみの上に - >ごみをゴミ箱に>ゴミ箱にゴミ箱に> – danielori