How can I overcome the CORS policy blocking my external API?

Hello, I am rather stuck on a task, and would really appreciate some help.

I am try to get statistics through a external API, which returns some json data. I would then like to display this data on my store front. This is my current code to fetch the data.

jQuery.ajax({
      url: 'some-url',
      dataType: 'json'
    })
    .done(function(result){
        var value = result.data[0].value;
        document.getElementById('data').innerHTML = value;
    })
	.fail(function() { 
        console.log('Error fetching data')
     });

However I keep getting the following error.

'Access to XMLHttpRequest at “…” from origin “…” has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. ’

Could someone please help or guide me on how to get around this.

Many thanks

Do you have access to the external API? if so you will have to modify the response to include CORS headers.