Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript PHP jQuery将数据加载到引导模式框中_Javascript_Php_Jquery_Mysql_Twitter Bootstrap - Fatal编程技术网

Javascript PHP jQuery将数据加载到引导模式框中

Javascript PHP jQuery将数据加载到引导模式框中,javascript,php,jquery,mysql,twitter-bootstrap,Javascript,Php,Jquery,Mysql,Twitter Bootstrap,我需要将动态数据加载到引导模式框中 JS: PHP文件: if(isset($_POST['cmid'])){ $DB = mysqli::f("SELECT * FROM " . BOOKS . " WHERE id = ?",filter_var($_POST['cmid'], FILTER_VALIDATE_INT)); print_r($DB); } 并使用class=“something”将数据打印到modalboxdiv。此方法有效,并打印所有php数组结果 现在我需要在将数据加

我需要将动态数据加载到引导模式框中

JS:

PHP文件:

if(isset($_POST['cmid'])){
$DB =  mysqli::f("SELECT * FROM " . BOOKS . " WHERE id = ?",filter_var($_POST['cmid'], FILTER_VALIDATE_INT));
print_r($DB);
}
并使用
class=“something”
将数据打印到modalbox
div
。此方法有效,并打印所有php数组结果

现在我需要在将数据加载到modalbox后使用php数组(使用php类、安全数据等)。我的意思是:将php数据加载到modalbox中(即:
json
不将结果打印到modalbox中

我怎样才能生成这个呢?

嗨,伙计,举个例子:

我希望这有助于。。。

你的方法可能比我的方法更有效!!!在您的方法中,您可以将所有结果打印到模式框中!!我不需要回答这个问题。你能更具体地回答这个问题吗?
if(isset($_POST['cmid'])){
$DB =  mysqli::f("SELECT * FROM " . BOOKS . " WHERE id = ?",filter_var($_POST['cmid'], FILTER_VALIDATE_INT));
print_r($DB);
}
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary btn-lg" id="insert">
  insert data
</button>

<!-- Modal -->
<div class="modal fade" id="myModal" 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>
$('#insert').on('click', function (){
    // This should be on your AJAX Success
    var data="some dynamic data";
    $('.modal-body').html(data);
    $('#myModal').modal('show');
    //--------------------------------------
})