I am writing a gnome shell extension in java script. I tried using asynchronous fetch() but it didn't work.
How can I fetch data from a server in JSON format and display it on my status bar?
const http = new XMLHttpRequest()
let data,button;
function load(){ >
http.open("GET", "https://example.com/")
http.send()
http.onload = (function(){
data = JSON.parse(http.responseText);
button.set_text(JSON.stringify(data));
})
}
load()