1

I have this code in a HTML page. I want to pass the variable to the function and the function to use it with the hostname variable.


   <script> var hostname = ["host","url1","url2","url3"]; </script>
 [...]
   <script>
function stopvm(param) {
    console.log(param[1])
    var _url = param[1];
    $.ajax({
        type: 'POST',
        url: _url
    });
}
</script>
<button onclick="stopvm('hostname')">Stop</button>

Is this possible?

Alexis Wilke
  • 19,179
  • 10
  • 84
  • 156

0 Answers0