Javascript Fetch API Tutorial - Get Request

https://mindsit.net/call-a-rest-web-service-in-javascript-using-fetch-api

by martinschneider23

HTML

<button onclick="callWs()">
Click
</button>
<br/>
<b>Response Status :</b>
<div id="result">
</div>
<br/>
<b>JSON Object :</b>
<div id="result_json">
</div>

JavaScript

callWs = function(){
	fetch('https://reqbin.com/echo/get/json', {
   headers: {
      'Accept': 'application/json'
   }
})
   .then(response => response.text())
   .then(text => console.log(text))
}