I encountered an issue while working on a web project using the PlanGrid API. I am receiving a cross-domain request block error.
var apiKey="API KEY";
var password="PASSWORD";
$.ajax({
url: "https://io.plangrid.com/projects",
xhrFields: {
withCredentials: true
},
headers: {
"Authorization": "Basic " + btoa(apiKey + ":" + password),
Accept:'application/vnd.plangrid+json; version=1'
},
type: 'GET',
crossDomain: true,
success: function (data) {
console.log(JSON.stringify(data));
},
error: function (data){
console.log(JSON.stringify(data));
}
});
Following the ajax request, an error is displayed:
"Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 401."
If anyone can assist me in identifying where I might have made a mistake, I would greatly appreciate it. Thank you!