Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const switcher = (Switch, getURL) => {
- const xnr = new XMLHttpRequest();
- sw = document.getElementById(Switch);
- if (sw.checked) {
- xnr.open('GET', `/${getURL}/1`);
- xnr.send();
- } else {
- xnr.open('GET', `/${getURL}/0`);
- xnr.send();
- }
- };
- switcher('switchled', 'led');
- switcher('switcholed', 'outled');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement