mirror of
https://github.com/Pathduck/pathduck.github.io.git
synced 2025-12-29 11:45:20 -05:00
16 lines
408 B
JavaScript
Executable File
16 lines
408 B
JavaScript
Executable File
callWs = function(){
|
|
// The Endpoint URL
|
|
let url = 'https://httpbin.org/get';
|
|
fetch(url)
|
|
.then(function(response) {
|
|
// Render the Response Status
|
|
document.getElementById('result').innerHTML = response.status;
|
|
// Parse the body as JSON
|
|
return response.json();
|
|
})
|
|
.then(function(json) {
|
|
// Render the parsed body
|
|
document.getElementById('result_json').innerHTML = JSON.stringify(json);
|
|
})
|
|
}
|