XMLHttpRequest No 'Access-Control-Allow-Origin' header is present on the requested resource [duplicate]

0

I am making multiple GET requests in an API and sometimes I get the message No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 429. and sometimes not, what can it be? This is my code:

for(let i=0;i<enderecos.split('\n').length;i++){
        urlTemp= url + enderecos.split("\n")[i] + apiCode;
        let xmlHttp = new XMLHttpRequest();             
        xmlHttp.open("GET", urlTemp, true); // true for asynchronous   

        xmlHttp.onreadystatechange = function() { 
            if (xmlHttp.readyState === XMLHttpRequest.DONE && xmlHttp.status === 200){
                callback(xmlHttp.responseText, enderecos.split("\n")[i]);                     
            }

        }
      xmlHttp.send();
    }
    
asked by anonymous 29.05.2018 / 17:15

0 answers