簡體   English   中英

引導模式數據未從jQuery傳遞

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM