No 'Access-Control-Allow-Origin' header error for API call with a button


I have a button on my form to get a company's details via the UK Government Company House API (registry of all companies in the UK). The script errors (error text copied from the Chrome console):

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

I tested the script with a CORS proxy in the URL - it runs ok and returns the company details to the form. However, I don't want to use a CORS proxy in the live form for security concerns.

Is there another solution?

This is the script (without a CORS proxy):
type: "GET",
url: "" + fd.field('CoNum').value,
dataType: 'json',
async: false,
headers: {
"Authorization": "Basic xxxx"
success: function (response){
fd.field('CoName').value = response.company_name;
error: function(xhr){
alert(xhr.status + ": " + xhr.statusText);


Hello @Dayne_Frost,

You can try out solution described here: