Reputation: 4984
I am getting below error in Angularjs
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://.../... (Reason: CORS header 'Access-Control-Allow-Origin' missing).
below is my code:
$http({
method: 'GET',
url:"https://logis../oms/rest/TMS/../listTenders/1.0",
headers: { 'Authorization': 'Basic Q2FycmllckFUcmFuc01ncjpwYXNzd29yZA=='}
}).success(function (response) {
console.log("response--"+response);
resolve(response);
}).error(function (error) {
console.log("error123--"+error)
reject(error);
});
I am using GET request in AngularJs and getting above error. So can any one help me if any thing is missing from client side or any thing is remaining from Server Side Server side is written in Java So please help me out. Thanks
Upvotes: 3
Views: 6406
Reputation: 61
There are two ways for making cross origin requests. 1) Your server is configured to allow such requests 2) Using JSONP from jquery/javascript, For more detailed examples, see below link: https://learn.jquery.com/ajax/working-with-jsonp/
Upvotes: 0
Reputation: 267
I got the same error.. Try calling the url from ur server side language (PHP or NOde)... Youll always get CORS error if u use a client side language(angular or normal AJAX) to call it.
Upvotes: 1