bootstrap从另一个页面和javascript文件打开模态

时间:2018-03-02 02:37:25

标签: javascript twitter-bootstrap bootstrap-modal

我尝试从另一个页面和javascript文件打开模态,只得到黑屏

javascript文件

    $('.myModal').on('click',function(){
    $.ajax({
        type: "POST",
        url : base_url +"/Time",
        data: "_token=HZNyRybabXWcTwp4kbeVpVsUGiuiYzFBDdiRJtZk" ,
        success: function(response) 
        {
            console.log(response);
            $('.Stime').html(response);
        }
    });
});

主页

<div class="Stime"></div>


    <!-- Button trigger modal -->
    <button type="button" class="myModal" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModals">
      Launch demo modal
    </button>

模态页面

为time.html

<!-- Modal -->
<div class="modal fade" id="myModals" 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">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>

我不知道为什么我只有黑屏

0 个答案:

没有答案