I am trying to send a mail request with the following code. But the request is sent as a GET request, not a POST request. How to fix it.
$.ajax({ url: 'https://www.exampleurl.com', method: 'POST', headers: {"Access-Control-Allow-Origin": true}, data: {url:'bla',call:"trans"} dataType: 'jsonp', success: function(data){ console.log('succes: '+data); } });
This is the error I get XMLHttpRequest cannot load https://example.com . The response to the request before the flight does not pass the access control check. There is no "Access-Control-Allow-Origin" header on the requested resource. Origin ' http: // localhost ' is therefore not allowed. The response was an HTTP 401 status code.
When I delete the Access-Control-Allow-Origin header, I get 404 error
gates source share