您好我一直在查看JQuery完整日历每件事都很棒但有人知道如何使用事件ID运行Mysql select查询。我想要实现的是在事件点击,获取事件ID并运行MySQL选择查询,然后在引导模式中打开结果。
custom.js 事件点击:
eventClick: function (event, jsEvent, view) {
endtime = moment(event.end).format('h:mm:ss a');
starttime = moment(event.start).format('Do MMM YYYY, h:mm:ss a');
startit = moment(new Date()).format("YYYY-MM-DD HH:mm:ss");
endit = moment(new Date()).format("YYYY-MM-DD HH:mm:ss");
var mywhen = starttime + ' - ' + endtime;
$('#modalTitle').html(event.title);
$('#modalBody').html(event.description);
$('#eventUrl').attr('href',event.url);
$('#appointment #when').text(mywhen);
$('#appointment').modal();
$.ajax({
url: '',
data: {'id':event.id, 'staff':event.resources},
type: "POST",
success: function (json) {
alert('Added Successfully');
}
});
console.log(startit);
console.log(event);
console.log(event.resources);
},
模态index.php
<!-- Modal -->
<div class="modal fade" id="appointment" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Appointment</h4>
</div>
<div class="modal-body">
<div class="row"><div class="col-md-4"><div id="modalTitle"></div></div><div class="col-md-8">
<div id="when">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" id="submitButton" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
mysql选择查询index.php
<?php
$query = "SELECT AppId, CustomerId, CONCAT(Clients.FirstName,' ',Clients.LastName) AS name, Staff, TimeStart, StageTime, GapTime, StageTime2, GapTime2, StageTime3,
Services.Service, Services.Background, Services.ServiceCost, Services.Oap, Cost FROM Appointments
LEFT JOIN Apptime ON Appointments.AppId = Apptime.AppT
LEFT JOIN Apptime2 ON Appointments.AppId = Apptime2.AppT2
LEFT JOIN Apptime3 ON Appointments.AppId = Apptime3.AppT3
LEFT JOIN Clients ON Appointments.CustomerId = ClientId
LEFT JOIN Services ON Appointments.ServiceId = SId
WHERE
AppId =".$Id;
$result = mysqli_query($mysqli, $query) or die('-1'.mysqli_error());
$row = mysqli_fetch_assoc($result); {result ....} }?>
我可以获取事件ID并使模态打开。我试图使用ajax发布到自我。我需要填充模态的信息,因为我有3个部分约会,例如。 30分钟然后差距60分钟,第二部分预约30分钟。我需要考虑约会的长度。因此,在一个坚果shell中,click事件触发MySQL查询,事件id为bootstrap模式打开结果。任何想法,请