-1

I use jqgrid to show my data, and I am trying to delete a record. I use http DELETE request to send request to server.

I checked my firebug console, It looks like it is not sending "oper" and "id" to server.

When I Changed the request type to POST it is sending values to server.

Q : How can use DELETE type in jqgrid so that it sends data to sever.

Prasanth Bendra
  • 31,145
  • 9
  • 53
  • 73

1 Answers1

1

HTTP DELETE should don't send and parameters in the body of HTTP request. Instead of that one should append all required options to the URL. See the answer for more information about HTTP DELETE restrictions.

So you should append id to the URL in the form /{id} or in the parameters form ?id={id} depend on the server part which you use. For example the following Delete options appends id in the form /{id} to the main delete-URL "/yourUrl/":

$("#grid").jqGrid("navGrid", "#pager",
    {edit: false, add: false, search: false}, {}, {},
    { // Delete parameters
        mtype: "DELETE",
        serializeDelData: function () {
            return ""; // don't send and body for the HTTP DELETE
        },
        onclickSubmit: function (params, postdata) {
            params.url = "/yourUrl/" + encodeURIComponent(postdata);
        }
    });

I recommend you to read the answer for more details.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798