Help to multi links cURL

<!DOCTYPE html>

<html>

<head>

<title>Page Title</title>

</head>

<body>

</style>

<script>

function open_all(){

var urls = document.getElementById(“list_urls”).value;

var urls = urls.split(’\n’);

var totalno = urls.length;

var s;

for(var i=0;i<totalno;i++){

s = urls[i];

if(s){

if(s.substr(0,7)!=‘http://’) s = ‘http://’+s;

window.open(s);

}

}

return false;

}

</script>

</body>

<form method=“post” action="">

<br />

<textarea name=“list_urls” id=“list_urls” cols=“60” rows=“20”></textarea>

<br /><br />

<input value=“Open URLs” class=“submit” type=“button” onClick=“open_all();”><br /><input type=“reset” value=“Reset!”><br/></form>

</html>

It work wen I put my links in that but ofcause it will open new page or link (:
I am lost :frowning:

Updated your code post.

You are using a submit and opening windows. You are not making AJAX calls like I posted?

Hi
Yes i no. I have try the code you have postet but I can’t get it to work ?
The code I posted was only for info if it cut give an idea how my Mcu are getting the info?

Cheers
Jimmy

Mine uses JQuery for it, and if you are not including that library, it won’t do anything. May that be the issue?

This is the full file to test a single IP address:

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<input type="button" class="inactive" id="b1">
<input type="button" class="inactive" id="b2">
<input type="button" class="inactive" id="b3">
<input type="button" class="inactive" id="b4">
<style>
.inactive {
  background-color: grey;
  color: white;
}

.active {
  background-color: red;
}
</style>
<script>

$(document).ready(function(){
    var state = "ON";
    $('input[type="button"]').on('click', function(){

//      $( [1,2,3,4] ).each(function() {
      var status = state == "ON" ? "Off" : "ON";
      alert("Current status is: " + status);
      $.get( "http://192.168.10/led?state=TURN+RED+" + status, function( data ) {            
                $( "#b1").removeClass(status == "ON" ? "active" : "inactive");
                $( "#b1").addClass(status == "ON" ? "inactive" : "active" );   
                state = (state == "ON" ? "Off" : "ON");
       });
//      });  
    });
});

</script>

</body>
</html>
Sponsor our Newsletter | Privacy Policy | Terms of Service