div class="custom-control custom-checkbox"> <input type="checkbox" class ="custom-control-input" id="temperature"> <label class = "custom-control-label" for="temperature">Temperature</label> </div> <div class = "custom-control custom-checkbox"> <input type = "checkbox" class="custom-control-input" id="illuminance"> <label class = "custom-control-label" for = "illuminance">Illuminance</label> <div class="form-group"><br> <div class="custom-control custom-checkbox"> <input type="checkbox" class ="custom-control-input" id="button-state"> <label class = "custom-control-label" for="button-state">Button-State</label> </div> <div class="col-md-1.9 text-center"> <button id="download" name="download" class="btn btn-warning" >Download</button><br> $(function() { $("#download").click(function(e) { e.preventDefault(); if($('#temperature,#illuminance').is(':checked')){ window.open("https://api.thingspeak.com/channels/899906/feeds/last.csv?api_key=F35GLOFJ8L99D0OM", "_blank"); } }); }); // checking for per number of entries to read. /* $(function() { $("#download").click(function(e) { e.preventDefault(); if($('#temperature').is(':checked')) { window.open('https://api.thingspeak.com/channels/899906/fields/1.csv?results=10'); } if($('#illuminance').is(':checked')){ window.open('https://api.thingspeak.com/channels/899906/fields/2.csv?results=10'); } if($('#button-state').is(':checked')){ window.open('https://api.thingspeak.com/channels/899906/fields/8.csv?results=10'); } });
$('#temperature')
document.getElementById("temperature").checked
$('#temperature')[0].checked
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)