Difference between revisions of "Thingspeak talkback javascript"
m (1 revision) |
|
(No difference)
|
Latest revision as of 16:52, 11 September 2015
- j.php
<javascript>
<!DOCTYPE HTML> <html> <head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js" ></script> <script type="text/javascript"> function btn_LED_ON() { $.ajax({ url: "https://api.thingspeak.com/talkbacks/63/commands?key=29Z3EVEWFNBYC9NV&command_string=LED_ON&position=1", type: 'POST', success: function(data) { //called when successful console.log(data); //$('#results').append(data); } }); } function btn_LED_OFF() { $.ajax({ url: "https://api.thingspeak.com/talkbacks/63/commands?key=29Z3EVEWFNBYC9NV&command_string=LED_OFF&position=1", type: 'POST', success: function(data) { //called when successful console.log(data); //$('#results').append(data); } }); } function btn_LED_BLINK() { $.ajax({ url: "https://api.thingspeak.com/talkbacks/63/commands?key=29Z3EVEWFNBYC9NV&command_string=LED_BLINK&position=1", type: 'POST', success: function(data) { //called when successful console.log(data); //$('#results').append(data); } }); } function btn_LED_BLINK_FAST() { $.ajax({ url: "https://api.thingspeak.com/talkbacks/63/commands?key=29Z3EVEWFNBYC9NV&command_string=LED_BLINK_FAST&position=1", type: 'POST', success: function(data) { //called when successful console.log(data); //$('#results').append(data); } }); } </script>
</head> <body>
Thingspeak API Buttons
</br>
<input id="LED_ON" width=200px type="button" value="ADD LED ON" onclick="btn_LED_ON();" />
<input id="LED_ON" width=200px type="button" value="ADD LED OFF" onclick="btn_LED_OFF();" />
<input id="LED_ON" width=200px type="button" value="ADD LED BLINK" onclick="btn_LED_BLINK();" />
<input id="LED_ON" width=200px type="button" value="ADD COMMAND LED_BLINK_FAST" onclick="btn_LED_BLINK_FAST();" />
<form action="https://www.thingspeak.com/channels/8053/feed.json?key=29Z3EVEWFNBYC9NV"> <input type="submit" value="JSON FEED"> </form> <form action="https://www.thingspeak.com/talkbacks/63/commands/133?key=29Z3EVEWFNBYC9NV"> <input type="submit" value="GET"> </form> <form action="https://www.thingspeak.com/talkbacks/63/commands/last?api_key=29Z3EVEWFNBYC9NV"> <input type="submit" value="LAST"> </form> <form action="https://www.thingspeak.com/talkbacks/63/commands?api_key=29Z3EVEWFNBYC9NV"> <input type="submit" value="LIST ALL"> </form> <form action="https://www.thingspeak.com/talkbacks/63/commands/execute?api_key=29Z3EVEWFNBYC9NV"> <input type="submit" value="EXECUTE"> </form>
</body> </html>
</javascript>