Prajna Bhat in MATLAB Answers
Last activity on 11 Feb 2023

The ThingSpeak API provides the possibility to embed the chart with historical values of a channel in a web page. Now I would also like to show the last value of a channel as a number on this page. I looked into some of the answers. But I could not understand. Can someone please share the JavaScript code OR the HTML code? I am new to ThingSpeak and Web Development. Please help me out!! Thank you, Prajna Bhat
Prajna Bhat in Discussions
Last activity on 5 Jul 2021

Hi all, The ThingSpeak API provides the possibility to embed the chart with historical values of a channel in a web page. Now I would also like to show the last value of a channel as a number on this page. I looked into some of the answers. But I could not understand. Can someone please share the JavaScript code OR the HTML code? I am new to ThingSpeak and Web Development. Please help me out!! Thank you, Prajna Bhat Javascript to display last value of a channel on web page | ThingSpeak API thingspeakapi javascript html thingspeak
Gcobani Mkontwana in MATLAB Answers
Last activity on 26 Nov 2019

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.
Gcobani Mkontwana in MATLAB Answers
Last activity on 6 Nov 2019

Hi Team Is there any mate who can show me in Ajax, if there is better approach to read values in your ajax call request? That will read these values as they are passed on your parameter. What i want to achieve is similar to an example of light bulb, if the bulb is set true is on. If the bulb is set false is off. Now i want something similar to my below code logic for my current channel. Currently the buttons only accept these moment they are fired from the browser, i want a better approach and scale my application better. <div class="col-md-2 text-center"> <button id="singlebutton" name="singlebutton" class="btn btn-primary">Subscribe</button> <br> </div> <!------ ----> <br/> <div class = "col-md-2 text-center"> <button id = "singlebtn" name="singlebtn" class="btn btn-primary">Unsubscribe</button> <br> </div> <script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script> $(document).ready(function(){ $.ajax({ url:'https://api.thingspeak.com/update?api_key=***&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); } }); // second button for unsubscribe. $(document).ready(function(){ $.ajax({ url:'https://api.thingspeak.com/update?api_key=***&field8=1', type:'GET', data:{ format:'text' }, success:function(response){ alert(response); }, error:function(){ $('#error').text("There was an error processing your request.Please try again"); $('#singlebtn').append(data); } }); }); }); </script>

About ThingSpeak

The community for students, researchers, and engineers looking to use MATLAB, Simulink, and ThingSpeak for Internet of Things applications. You can find the latest ThingSpeak news, tutorials to jump-start your next IoT project, and a forum to engage in a discussion on your latest cloud-based project. You can see answers to problems other users have solved and share how you solved a problem.