I am trying to call an api get request by the ajax method but I am getting the Cross-Origin Request Blocked
error, I have set header 'Access-Control-Allow-Origin': '*'
but still I am getting this error also while setting the header why does the HTTP GET request changes to OPTION.
here is my code.
$.ajax({
url: "https://api.ontraport.com/1/objects?objectID=5",
type: 'GET',
dataType: 'json',
headers: {
'Api-Appid': '********',
'Api-Key': '*******',
'Access-Control-Allow-Origin': '*'
},
success: function(data) {
console.log(data);
},
error: function(error) {
console.log(error);
},
});