Am using ajax and jquery in my .net application ,
the consuming of the Payment api is by using ajax ,
this api has (basic auth + post type),
when i try to fire it i get :-
"Access to XMLHttpRequest at 'API URL' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource."
i have tried using , JSONP didn't work -> a pop appears asking my username and password ,
i have tried using this plugin jquery.ajax-cross-origin , for proxy bypass
didn't work -> its takes alot of time then same problem
this my ajax code :
$.ajax({
// crossOrigin: true,
url: "api url",
type: "POST",
beforeSend: function (xhr) {
xhr.setRequestHeader ("Authorization", "Basic " + btoa("name" + ":" + "password"));
},
headers: {
'Access-Control-Allow-Origin': '*'
},
am figuring out that i can do something with .net adding a header or something , this have take a lot of time from me ,but still didn't reach solution .
Also , its working if i use a chrome plugin to enable CROS share , but this is not a production solution ,
Thanks in advance .