afgprogrammer/PHP-MVC-REST-API

Cors error in ajax call

mahdieyv99 opened this issue · 0 comments

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at "url" (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

but in postman or android (java) not problem

$.ajax({
url: 'https://example.com',
type: 'POST',
data: {
id: "2"
},
success: function (result) {
console.log(result)
}, error:function() {
console.log("error")
}
})

why?