when I send a request to erpnext api using axios or jquery ajax it gives me this error in console
from origin 'null' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
and this my jquery code
var jqxhr = $.ajax({
type:'get',
dataType:'json',
contentType:'jsonp',
url:"<my url endpoint>",
headers:{
'Access-Control-Allow-Origin' : '*',
'Access-Control-Allow-Methods' : 'GET,PUT,POST,DELETE,PATCH,OPTIONS',
} })
.done(function() {
alert( "success" );
})
.fail(function() {
alert( "error" );
})
.always(function() {
alert( "complete" );
});
i just created an index.html
and add this script
but when I use python request it works