Basic fetch example

by Kamal Kumawat

HTML

<input type="button" id="basicFetchButton" value="Try it">

JavaScript

document.getElementById("basicFetchButton").addEventListener("click", function(){
        // Loading the jQuery code
        fetch("http://localhost:3000/graph/graphData")
            .then(function (response) {
                response.text().then(function (responseText) {
                    console.log(typeof responseText);
                    alert("Done using Fetch!");
                });
            });
    });