var url = "https://en.wikipedia.org/w/api.php"; var params = { action: "compare", format: "json", fromtitle: "Template:Unsigned", totitle: "Template:UnsignedIP", origin: "*" }; fetch(url + "?" + (new URLSearchParams(params)).toString()) .then(resp => resp.json()) .then(data => { console.log("data", data); }) .catch(err => { console.log("bad", err); });