According to jQuery's documentation $.ajax()
supports "other HTTP request methods, such as PUT and DELETE, can also be used here, but they are not [necessarily] supported by all browsers." [1]
I'm wondering if there is a way to check if a browser supports a given method, e.g. PATCH
, PUT
, DELETE
, etc. and gracefully degrade to a POST
method using $.ajaxPrefilter()
if it is unsupported? Or, is it better to just always POST
from the form or AJAX call and use some other context (e.g. _method
, or server supported X-header) to indicate the intended method, rather than what was actually used?
UPDATE: It appears that one way to test whether a particular request type is supported is to actually make the request, e.g.
var x=new XMLHttpRequest();
x.open("patch", "/");
x.send(null);
However, I'd like to avoid making any requests when determining support for particular request types, if possible.