0

I am using REST service that is being invoked from bootstrap form submission which is being opened from hyperlink click event.REST is containing GET,POST,DELETE methods but for one of my requirement i want DELETE to be invoked but GET is being Called..Here is my form..

<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>

and here is how to perform click operation..

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

Please help me to get it done.Thanks..

Lara
  • 2,821
  • 7
  • 39
  • 72

1 Answers1

2

delete isn't a valid value for the method attribute.

HTML forms support only post and get.

You can't make a DELETE request from a webpage without using Ajax (specifically XMLHttpRequest).

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335