Hello all!
I have a problem with my web server for home automation. I try read switch input and display on my website.. and its works (ON / OFF).
I used this code:
var count;
var num_an = this.responseXML.getElementsByTagName('switch').length;
for (count = 0; count < num_an; count++) {
document.getElementsByClassName("doors")[count].innerHTML =
this.responseXML.getElementsByTagName('switch')[count].childNodes[0].nodeValue;
}
and my arduino get:
// read switches
for (count = 0; count < 3; count++) {
cl.print("");
if (digitalRead(sw_arr[count])) {
cl.print("OFF");
}
else {
cl.print("ON");
}
cl.println("");
}
When I push the button i get on my website -> "ON", but i would like to get for example background red color for my div?
How can i do this?
Hehe,
Yeah sorry but my english isn't very good and i dont know how to "transfer" my thoughts
Ok, so...
When I push the button i get on my website -> "ON", but i would like to get for example background red color for my div?
How can i do this?
I tried this code, but not results..
for (count = 0; count < 3; count++) {
cl.print("<switch>");
if (digitalRead(sw_arr[count])) {
client.println("<script>");
client.println("$('.doors').css('background', 'blue');");
client.println("</script>");
}
else {
...
}
cl.println("</switch>");
}
system
November 8, 2016, 1:07pm
5
client.println("<script>");
client.println("$('.doors').css('background', 'blue');");
client.println("</script>");
Why are putting this in script tags?
What does this have to do with the Arduino? NOTHING! Your issues is STRICTLY an html/style sheet issue.
Easy, I am beginner...
I would like to only change text to background color when arduino read switch...
I have 4 doors.. and i read state from pins and display on my web server (website).
I received data from arduino and I dont know how to change on website.