小编use*_*455的帖子

将参数发送到Bootstrap模态窗口?

我有一个问题,我无法将任何参数传递给模态窗口(使用Bootstrap 3),我尝试使用此链接中所述的解决方案,但我无法使其工作:

动态加载信息到Twitter Bootstrap模式

(解决方案kexxcream用户).

但是按下按钮,显示屏不显示任何东西,显然是块,附上下面的图片:

http://i.imgur.com/uzRUyf1.png

我附上了代码(左上方的代码相同);

HTML代码:

      <div id="myModal" class="modal hide fade">
      <div class="modal-header">
        <button class="close" data-dismiss="modal">&times;</button>
        <h3>Title</h3>
      </div>
      <div class="modal-body">            
          <div id="modalContent" style="display:none;">

          </div>
      </div>
      <div class="modal-footer">
        <a href="#" class="btn btn-info" data-dismiss="modal" >Close</a>
      </div>
  </div> 
Run Code Online (Sandbox Code Playgroud)

JS代码:

    $("a[data-toggle=modal]").click(function() 
    {   
        var essay_id = $(this).attr('id');

        $.ajax({
            cache: false,
            type: 'POST',
            url: 'backend.php',
            data: 'EID='+essay_id,
            success: function(data) 
            {
                $('#myModal').show();
                $('#modalContent').show().html(data);
            }
        });
    });
Run Code Online (Sandbox Code Playgroud)

按钮:

<a href='#myModal' data-toggle='modal' id='2'> Edit </a>
Run Code Online (Sandbox Code Playgroud)

PHP代码(backend.php):

<?php
$editId = $_POST['EID'];
?>
  <div class="jumbotron">
   <div class="container">
    <h1>The …
Run Code Online (Sandbox Code Playgroud)

html jquery window modal-dialog twitter-bootstrap

20
推荐指数
2
解决办法
14万
查看次数

标签 统计

html ×1

jquery ×1

modal-dialog ×1

twitter-bootstrap ×1

window ×1