fetch('https://domain-availability-api.com/check?domain=' + userInput) .then(response => response.json()) .then(data => { if (data.available) { console.log(userInput + ' is available!'); } else { console.log(userInput + ' is not available.'); } });