Post JSON ajax request with cors not working in IE10/Edge
There are a few things you can check client-side:
- you're trying to override
$.support.cors
. This is (or was) meant to be a readable property telling you if CORS is supported by the browser. (see jQuery source for where this is checked) - Based on jQuery docs for ajax you might want to add
xhrFields: { withCredentials: true }
to the$.ajax()
options - Use correct casing of
dataType: "json"
andcharset=UTF-8
At server-side, you may want to try responding with specific hostname (echo the Origin
header) instead of wildcard (*
) in the Access-Control-Allow-Origin
response header. This is specifically mentioned in MDN in a paragraph also discussing Access-Control-Allow-Credentials
:
Important note: when responding to a credentialed request, server must specify a domain, and cannot use wild carding. The above example would fail if the header was wildcarded as: Access-Control-Allow-Origin: *.
It's not a long term solution, but you could check out https://cors-anywhere.herokuapp.com/ You can GET or even POST data without issue through this.Include their link before your URL so https://cors-anywhere.herokuapp.com/http://ateet3371/Service1.svc/postdata and set that as the URL value in your ajax. Like I said, it's not a long term solution but if it works then see what you can do from there.
I wish I could be of more assistance. Good luck!