Jump to content

display variable status inside html script


ahmed_salah

Recommended Posts

hi,

i am new in html scripting ,this project using to control relay with netduino board , the code is attached it is a simple js page contains 2 buttons one for on and another for off , i want to when this page is displayed the status of led is displayed to to know if it is on or off for example a button box contains led is on with green color and the opposite button box with red color when led is off

LedController.cs.txt

Link to comment
Share on other sites

You'll need to add another route to get the status of the LED, however you do that with Netduino. Then you can add another ajax request to get the status of the LED when the page loads and show whether it is on or off. To change that, one way would be to add code inside the ajax request to change the LED so that it also updates the page (in that case, you're assuming what the LED state is). The other option is to send the ajax request to change the LED, then send another ajax request to get the status of the LED and update the page.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...