I am struggling to get two fields on one URL parameter using thingspeak REST API. I have the following that attempts to do such, but im bit stuck in the middle. The idea is i have 3 checkboxs, each of them so far is doing is allowing and downloading that specific field. I want a way where if i do the checking on my if statement from those checkboxs, it should allow me to download those fields as being 2 only on my CSV file. Here is my code for the checkbox in both HTML and Jquery.
// 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');
}
if($('#illuminance').is(':checked')){
window.open('https://api.thingspeak.com/channels/899906/fields/2.csv');
}
if($('#button-state').is(':checked')){
window.open('https://api.thingspeak.com/channels/899906/fields/8.csv');
}
});
});
// checking for either of fields.
$(function() {
$("#download").click(function(e){
e.preventDefault();
});
});
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sagar PardeshiPosted Nov 22, 2019, 7:11 AM