Hi,I have a project that I have made a web application that shows some buttons which interact with the client and accordingly to the values of the buttons, it makes changes on the server such as: if you turn on a button on the site, on the server you can see a led on...and so on.What I want to do now is upon a value (that is displayed as well on the site) put the button off and keep it there for secure reasons lets say...the code for the buttons is above
- "<script>"
- "$(document).ready(function(){ $('#red').bind( 'change', function(event, ui) { jQuery.ajaxSetup({timeout: 1000}); var id = $(this).attr('id'); var strength = $(this).val(); if (id == 'red') $.post('/remote', { red: strength } ); });});"
- "</script>"
- "<div data-role=\"fieldcontain\">"
- "<h2>LED</h2>"
- "<input type=\"range\" name=\"slider\" id=\"red\" value=\"0\" min=\"0\" max=\"255\" />"
- "</div>" ;
what I think I should add in order to make it work like what I mentioned before is sth like that what do you think?
- if (tempC>20){
- "<script >"
- "$(document).ready(function(){ $('#red').val()=0; var strength=$(#red).val(); $.post('/remote', { red: strength } )"};
- "</script>"
- };
it is a informal version. Someone suggested that I should work with setInterval or setTimeout functions though
what do you think about?thank you