Dear Hubspot Developer Team,
I’m trying to make an API request from my custom HubL in my Hubspot Template.
This is how I implemented the request:
function check_ContactExists(vobjInput) {
var vobjRequest = new XMLHttpRequest();
vobjRequest.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var vobjResponse = JSON.parse(this.responseText);
if (vobjResponse.status == "error"){
alert('Contact does not exists!');
}
else{
alert('Contact exists: ' + vobjResponse.vid);
}
}
};
vobjRequest.open("GET", "https://api.hubapi.com/contacts/v1/contact/email/testingapis@hubspot.com/profile?hapikey=demo", true);
vobjRequest.send();
}
But now I keep getting this error message:
Cross-Origin Read Blocking (CORB) blocked cross-origin response https://api.hubapi.com/contacts/v1/contact/email/testingapis@hubspot.com/profile?hapikey=demo with MIME type application/json. See Chrome Platform Status for more details.
What can I do to retrieve the response?
Kind regards