I'm trying to make the request to a third-party API via the following code:
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js"></script><script>$(function(){$.post({url:url,contentType:"application/json;",
data:"1",
headers: {'Authorization': 'Basic token'},
success: function(data) {
console.log(data)
}, error: function(err) {
console.log('error')
}
});
});
</script>
But I'm getting the following message back.
Mixed Content: The page at 'link-host' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'link-api'. This request has been blocked; the content should be served over HTTPS.
How to solve this problem? Through PHP I was able to make the request.