Custom HTTP verb with jQuery.ajax ()

Is it possible to use a custom HTTP VERB like MERGE with jQuery.ajax ()? I am interacting with the OData API, which expects the verb MERGE when posting record updates.

The problem I am facing is that when I use "MERGE" in the ajax () request, it does not send data to the server. It just sends a MERGE request without data, so the OData service rejects it.

When I change the request to PUT, the OData service sends back 500 errors.

My options are mainly for figuring out how to get “MERGE” calls to send data along with the request, do DELETE and then POST (delete and recreate the record with each update) or figure out how to change the OData service to accept PUT for updates.

Let me know if you have ideas on how to make jQuery.ajax () send data with a MERGE request.

Thank,

Dave

+3
source share
3 answers

OData supports MERGE tunneling through POST - which, of course, is supported through JQuery by adding an X-HTTP-Method header.

See thread for more.

Alex

Microsoft OData Program Manager

+4
source

This is not a question of the ability to jQueryprocess custom HTTP verbs; it is browser dependent .

+6
source

, - , .

- 2008 - :

  • IE doesn't seem to support it (at least until version 7)

  • Firefox supports it

  • Opera turns everything unknown into a request GET

I think you have to try.

+1
source

Source: https://habr.com/ru/post/1755585/


All Articles