I'm trying to get info from "darksky.net" using their api.
var xhr = new XMLHttpRequest();
    xhr.open(method, url, true);
        xhr.onload = function() {
            if (this.status >= 200 && this.status < 300) {
                resolve(xhr.response);
            } else {
                reject({
                    status: this.status,
                    statusText: xhr.statusText
                });
            }
        };
Please answer only in pure javascript.

 
     
     
     
    