[英]bootstrap modal data not passed from jQuery
我正在使用完整日历,因此我有以下模式可以插入新事件:
<div id="fullCalModal_add_appointment" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div id="after_post_message_appointment"></div>
<form id="add_appointment_form" method="post" class="form-horizontal" action="" enctype="multipart/form-data">
<input type="hidden" name="add_appointment_submit" value="add_appointment_submit">
<input type="hidden" name="booking_from" value="<?php echo $query1ans;?>">
<input type="text" name="selected_room" value="" id="selected_room">
而js是:
dayClick: function(date, jsEvent, view, resourceObj) {
/* var date_start = moment(date.format()).unix();
var data1 = moment(date.format()).unix();
var selected_room = resourceObj.id;*/
alert(resourceObj.id);
//alert('Clicked on: ' + date.format('hh:mm'));
//alert('Current view: ' + view_type);
$('#date_start').val(date.format('YYYY-MM-DD'));
//$('#time_start').val(date.format('hh:mm:ss A'));
$('#time_start').val(date.format('hh:mm A'));
//$('#view_type').val(resourceObj.id);
$('#selected_room').val(resourceObj.id);
$('#fullCalModal_add_appointment').modal();
},
现在的问题是,所有的var数据都没有传递给模态,我不明白为什么! 希望在这里找到解决方案,也因为对于其他相同的食物,类似的代码也可以工作!
在设置变量数据之前,应先调用modal()函数,如下所示:
dayClick: function(date, jsEvent, view, resourceObj) {
/* var date_start = moment(date.format()).unix();
var data1 = moment(date.format()).unix();
var selected_room = resourceObj.id;*/
// alert(resourceObj.id);
//alert('Clicked on: ' + date.format('hh:mm'));
//alert('Current view: ' + view_type);
$('#fullCalModal_add_appointment').modal();
$('#date_start').val(date.format('YYYY-MM-DD'));
//$('#time_start').val(date.format('hh:mm:ss A'));
$('#time_start').val(date.format('hh:mm A'));
//$('#view_type').val(resourceObj.id);
$('#selected_room').val(resourceObj.id);
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.