Hi,
i’d like to have a button to call an API. I just need to call an URL, not to open it.
I used action Open URL, the URL is called but it opens a new tab in my navigator, that’s not what I want.
I tried to use a function to make a HTTP request, but nothing happens (i don’t the URL call on the server).
This is the code I used with the execute action :
function request() {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.HEADERS_RECEIVED) {
print('HEADERS_RECEIVED');
} else if(xhr.readyState === XMLHttpRequest.DONE) {
print('DONE');
}
}
xhr.open("GET", "http://example.com");
xhr.send();
}
(from documentation)
Thanks for your help.
Best regards
YZ