When I send this ajax rquest:
$.ajax({
headers : {
\'Accept\' : \'application/json\',
\'Content-Type\' : \'appli
Could it be your browser doesn't support the PATCH method?
Taken from jQuery AJAX API documentation:
The type of request to make ("POST" or "GET"), default is "GET". Note: Other HTTP request methods, such as PUT and DELETE, can also be used here, but they are not supported by all browsers.
The $.ajax
method does support HTTP PATCH.
The problem you are seeing is that the ajax
method looks for PATCH in the Access-Control-Allow-Methods
response header of the options preflight check. Either this header is missing from your response, or the PATCH method was not included in the value of this header. In either case, the problem is in the server, not in your client-side code.
Here's an example using Java:
response.addHeader("Access-Control-Allow-Methods", "GET, POST, PATCH, PUT, DELETE");