How to create toggle button in jquery to update your thingspeak channel?

2 次查看(过去 30 天)
Hi Team
Can any mate, help me i want to create a 1 button to toggle when it turn on and off. But it must be able to read an update field from my thingspeak channel. I have tried the followin
<label for='opt2'></label>
<input type='checkbox' name='opt2' id='opt2' value='1' class='toggleswitch' />
// on click button toggle.
$(document).ready(function($) {
$('.toggleswitch').toggleSwitch();
$("#opt2").trigger("click"); // turn it on
if($(mainParent).find('input.toggleswitch').is(':checked')){
window.open('https://api.thingspeak.com/update?api_key=XXX&field8=1');
}
});
g both HTML and Jquery no luck.

回答(0 个)

社区

更多回答在  ThingSpeak Community

类别

Help CenterFile Exchange 中查找有关 ThingSpeak 的更多信息

产品


版本

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by