I am stuck in these 2 days, I can not find a solution. When I do AngularJS POST, it sends OPTIONS to the header and returns an API error, the code looks like nothing special.
$http.defaults.headers.post["Content-Type"] = "application/json"; $http.post(URL, JSON.stringify(data)). success(function(data, status, headers, config) { alert(data); error(function(data, status, headers, config) { console.log("Error"); });
CORS is included in the API, it has Headers, when I do POST with fiddler or POSTMan in Chrome, it works fine only when I use post angularJS, it will not go through.
Why am I getting OPTIONS /SubmitTicket HTTP/1.1 instead of POST?
What do I need to do with POST? I read about it, it says something like CORS, adding the OPTIONS header, but why?
source share