'thingsboard custom widget action call URL

Ive got a url that sends an SMS when called. all I want to do is have my widget call that URL on a click of its header icon. Below is what Ive done but it doesn't seem to work.

const xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
    if (xhttp.readyState != 4) return;
    console.log(xhttp.status);
    console.log(xhttp.responseText);
}

xhttp.open(method, url);
xhttp.send();


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source