Hi Team
I have this following code, it swich being enabled and disabled. Now i want to find a way if it is enable it must reads my data on thingspeak channel, using rest api key. Example below,
- <input type="checkbox" data-toggle="toggle" data-on="Enabled" data-off="Disabled">
- <input type="checkbox" id="toggle-two">
- <script> $(function()
- { $('#toggle-two').bootstrapToggle({ on: 'Enabled', off: 'Disabled' }); })
- $.ajax({
- url:'https://api.thingspeak.com/update?api_key=DLQ0F7W5FGVO1I9Q&field8=0',
- type:'GET',
- data:{
- format:'text'
- },
- success:function(response) {
- alert(response);
- },
- error:function(){
- $('#error').text("There was an error processing your request.Please try again");
- $('#singlebutton').append(data);
- }
- });
- }
- </script>
Can anyone help me to improve this code better please, thanks.