javascript - 带有 PHP 脚本的模式,将编辑特定数据的信息

标签 javascript php jquery modal-dialog bootstrap-modal

如何使用模态编辑特定数据。例如,当我单击数据旁边的按钮时,它将获取其id,并且会出现一个包含该特定数据的所有信息的模式?

下面是我将使用的模态示例,但只是没有 php 代码的普通模态。

<!-- Button trigger modal -->
<button type="button" class="btn btn-primary btn-md" data-toggle="modal" data-target="#myModal">
  Launch demo modal
</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>

最佳答案

这种情况你最好使用ajax

满足您需求的步骤是: 1.用ajax数据发送参数id。 2. 通过查询选择数据,并在 ajax url 中提到的文件中返回 JSON。 3. 最后,用您制作的 JSON 数据显示模态。

这是关于ajax的基础知识http://www.w3schools.com/jquery/ajax_ajax.asp

关于javascript - 带有 PHP 脚本的模式,将编辑特定数据的信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37518820/

相关文章:

php - 使用 JavaScript 或 PHP 的时间计数器

javascript - 更改禁用/启用字段

jquery - 如何修复 Django 中的错误 AttributeError : 'Country' object has no attribute 'City_set' .

javascript - 不显示以前的语句 (ng-show)

javascript - AJAX 发送数据到 Node.js 服务器

php - 页面顶部出现奇怪的空白区域 – HTML、CSS 和 PHP

php - 不用 Xdebug 生成 PHP 代码覆盖率

JavaScript 数字每次 parseFloat toFixed 都没有正确添加

javascript - Mozilla Firefox parseFloat 性能缓慢

php - 在 jquery 中调用 Codeigniter Controller 函数