TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guest User
Tech Writer
2.1k
473.4k
Toggle button does not work
Nov 13 2019 12:35 AM
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 functionality---->
<br>
<div class="form-group"><br>
<div class="col-md-3 text-center">
<input type= "checkbox" data-toggle = "toggle" data-onstyle="success">
</div>
</div>
// 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) {},
});
}
)
Reply
Answers (
5
)
How to make on button to update correctly and off not to ?
Datepicker with ok button and checkbox in a form