toggle toggle button status with javascript via json ??

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
leachimtrebron
Normal user
Posts: 24
Joined: 12 Mar 2018, 20:11

toggle toggle button status with javascript via json ??

#1 Post by leachimtrebron » 12 Mar 2018, 20:48

Hello forum community,
Sorry my bad english but I'll try my problem to describe

somehow I can not get on and need your help.

I've fished ESP easy GIT version mega-20180302 on my ESP and on
Attached GPIO 12-15 relays.

The switch over http works in principle:
e.g. http://192.168.178.152/control?cmd=gpio,13,1 for off
http://192.168.178.152/control?cmd=gpio,13,0 for on

Now I've built a html page with CSS and the switching goes from the principle here too.
But now comes my problem:

on the first call of my html page the switches are on the default value of the html page. So, they do not properly branch off to the right condition they are right now.

Now I have tried to call the http://192.168.178.152/json page via javascript to ask for the condition of my Raelays and here I am now hanging.

I would have to parse the page out of the html page and query the status of each individual relay and then view the state via the css / jacascript correctly.

I know that the function toggleCheckbox is not the nicest version but it works

Maybe the forum community can help me that would be great.

As an attachment, I have attached my html page and the page to be parsed.
as an attachment you will find my html button page and my json page which i would like to parse

Thank you for your support


greeting


redseasix
Attachments
CSS_Toggle_Switch_Button-6_3.zip
(2.51 KiB) Downloaded 289 times

Post Reply

Who is online

Users browsing this forum: No registered users and 31 guests