GET正在调用而不是DELETE

时间:2015-10-30 11:36:31

标签: javascript jquery rest twitter-bootstrap-3 http-delete

我正在使用从引导表单提交中调用的REST服务,该服务正在从超链接单击事件中打开.REST包含GET,POST,DELETE方法但是对于我的一个要求,我希望调用DELETE但GET被称为......这是我的表格..

<div class="modal alert" id="DeleteModal" tabindex="-1" role="dialog" aria-labelledby="DeleteModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog">
    <div class="modal-content">
        <form action="~/GetStudent" class="form-horizontal" role="form" method="delete" id="frmDelete">
  <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h3 class="modal-title" id="DeleteModalLabel">Confirm Delete</h3>
            </div>

                <input type="hidden" name="id" id="id" />

            <div class="modal-footer">
                <div class="pull-right">
                    <button type="submit" class="btn btn-success"><i class="glyphicon glyphicon-trash"></i> DELETE</button>
                    <button type="button" class="btn btn-danger" data-dismiss="modal"><i class="glyphicon glyphicon-remove"></i> CANCEL</button>
                </div>
            </div>
        </form>
    </div>
</div>

以下是执行点击操作的方法..

 $('#frm .glyphicon-trash').on('click', function () {
        var table = $('#tbl').DataTable();
        var data = table.row(this.closest("tr")).data();
        $("#id").val(data[3]);
    });

请帮我完成。感谢..

1 个答案:

答案 0 :(得分:2)

Student s("Mike"); Student s1 = s; // calls default copy constructor s1.setName("Bruce"); cout << s.getName(); cout << s1.getName(); 不是delete属性的有效值。

HTML表单仅支持methodpost

您无法在不使用Ajax(特别是get)的情况下从网页发出DELETE请求。