diff --git a/lights_web/static/index.html b/lights_web/static/index.html index 69b9db7..219afb7 100644 --- a/lights_web/static/index.html +++ b/lights_web/static/index.html @@ -218,6 +218,7 @@ return function(){ var toggle_request = new XMLHttpRequest(); toggle_request.open("POST", "/light/" + light.id + "/on/toggle", true); + toggle_request.setRequestHeader('Content-Type', 'application/json'); toggle_request.send(JSON.stringify(true)); }; }(light); @@ -226,9 +227,10 @@ return function ( lights ) { for ( i in lights ) { light = lights[i]; - var toggle_request = new XMLHttpRequest(); - toggle_request.open("POST", "/light/" + light.id + "/on/set", true); - toggle_request.send(JSON.stringify(true)); + var on_request = new XMLHttpRequest(); + on_request.open("POST", "/light/" + light.id + "/on/set", true); + on_request.setRequestHeader('Content-Type', 'application/json'); + on_request.send(JSON.stringify(true)); }; }; }(lights);