Javascript 使用引导和AJAX删除确认模式

Javascript 使用引导和AJAX删除确认模式,javascript,jquery,Javascript,Jquery,我试图创建一个模态弹出窗口,并在模态体中包含一个AJAX调用。 脚本包括AJAX。很好 下面是调用模态的按钮(我正在使用细枝模板) 这是带有模态的页面 <div class="modal fade" id="confirm-delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <di

我试图创建一个模态弹出窗口,并在模态体中包含一个AJAX调用。 脚本包括AJAX。很好

下面是调用模态的按钮(我正在使用细枝模板)

这是带有模态的页面

<div class="modal fade" id="confirm-delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">

      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title" id="myModalLabel">Confirm Delete</h4>
      </div>

      <div class="modal-body">

        <div class="alert alert-danger" role="alert">

          <p>Do you really want to delete <b>{{ product.name }}?</b></p>

        </div>

        <img src="{{ asset('uploads/product_images/') }}{{ product.image }}" style="width: 240px;" class="img-responsive thumbnail" />
      </div>

      <div class="modal-footer">
        <button type="button" id="misha" class="btn btn-default" data-dismiss="modal">Cancel</button>
        <a class="btn btn-danger btn-ok">Delete</a>
      </div>
    </div>
  </div>

&时代;
确认删除
是否确实要删除{{product.name}}

取消 删除

现在,如果单击delete按钮,我想使用相关页面(例如:delete.php)删除所选项目。

一种方法是附加一个click hander并设置如下位置

window.location.href = 'delete.php';
或者类似的事情

<a class="btn btn-danger btn-ok" href="delete.php">Delete</a>
<a class="btn btn-danger btn-ok" href="delete.php?ID={{ product.id }}">Delete</a>

如果您有产品ID,它将被发送到delete.php,如下所示

<a class="btn btn-danger btn-ok" href="delete.php">Delete</a>
<a class="btn btn-danger btn-ok" href="delete.php?ID={{ product.id }}">Delete</a>

一种方法是附加一个点击手柄,然后像这样设置位置

window.location.href = 'delete.php';
或者类似的事情

<a class="btn btn-danger btn-ok" href="delete.php">Delete</a>
<a class="btn btn-danger btn-ok" href="delete.php?ID={{ product.id }}">Delete</a>

如果您有产品ID,它将被发送到delete.php,如下所示

<a class="btn btn-danger btn-ok" href="delete.php">Delete</a>
<a class="btn btn-danger btn-ok" href="delete.php?ID={{ product.id }}">Delete</a>


因为这个问题,我觉得它看起来也很可爱。谢谢你记得我。因为这个问题,我觉得它看起来也很甜蜜。谢谢你记得我。