I have the following code currently. What it does is initiate a checkbox when downloaded CSV file, but the data inside has all the fields. I only want to get those being checked in my checkboxes.
Is there a way in jQuery to do this as I haven't done it before.
<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>
<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>
<!---Downloading File using Jquery with Buttons---->
<div class="form-group"><br>
<div class="col-md-1.9 text-center">
<button id="download" name="download" class="btn btn-warning">Download</button><br>
</div>
</div>
// Downloading file into zip file.
$(document).ready(function() {
$("#download").click(function() {
var count = 0;
if ($('#temperature').prop('checked'))
count++;
if ($('#illuminance').prop('checked'))
count++;
if ($('#button-state').prop('checked'))
count++;
if (count > 1) {
window.location.href = 'https://api.thingspeak.com/channels/899906/feeds.csv?start=2019-11-12%2019:11:12&end=2019-11-13%2019:11:13';
}
});
});