You're making a cross-origin request. The server needs to support CORS for that to work, which means it needs to support the
OPTIONS
method.
If it doesn't support that HTTP method, then it doesn't support cross-origin requests.
Cross-Origin Resource Sharing (CORS) - HTTP | MDN[
^]
NB: The code works in Internet Explorer because that ancient (and now
deceased[
^]) browser pre-dates the CORS security specification.