Hi Team
I have created a switch button, toggle button and it seem not working. Meaning i want my button when it switch on must send an update to my channel to thingspeak and when it switch off must do the same. Please help me to achieve this logic, thanks.
// button click functionality here.
$(document).ready(
function() {
$.ajax({
url:'https://api.thingspeak.com/update?api_key=DLQ0F7W5FGVO1I9Q&field8=1',
type:'GET',
data:{
format:'text'
},
success:function(response) {
alert(response);
},
error:function(xhr,status, errorThrown) {
console.log("There was an error processing your request" + errorThrown);
console.log("Status:" + status);
console.log(xhr);
},
complete:function(xhr,status) {},
});
}
)

Jenith ThakkarRank #789 · 2.9K reputationPosted Nov 12, 2019, 10:40 PM EST
Jenith ThakkarRank #789 · 2.9K reputationPosted Nov 12, 2019, 7:53 PM EST
Please check below link for your reference
Guest UserRank #877 · 2.5K reputationPosted Nov 12, 2019, 8:03 PM EST
Jenith ThakkarRank #789 · 2.9K reputationPosted Nov 12, 2019, 8:29 PM EST
Guest UserRank #877 · 2.5K reputationPosted Nov 12, 2019, 9:22 PM EST