I am trying to send a HTTP POST with JSON via jQuery to a local network app (Hue Emulator: http://steveyo.github.io/Hue-Emulator/) with this code:
$.post("http://localhost/api/newdeveloper/lights/6/state", "{\"on\": false}", function (data, textStatus, jqXHR) {
console.log(data);
});
On the console of the app I see this response:
So, 12 Nov 2017 15:47:58 /api/newdeveloper/lights/6/state
So, 12 Nov 2017 15:47:58 {"on": false}
Which is the same as in this image: https://raw.githubusercontent.com/SteveyO/Hue-Emulator/master/screenshot.png
But I don't see any response and also the light bulb doesn't turn off visually in the emulator. Is there a problem with jQuery and sending localhost-POST requests? This is the result I see in Google Chrome:
With this approach:
$.ajax({
type: "POST"
, url: "http://localhost/api/newdeveloper/lights/6/state"
, data: {
"on": false
} // or {"on": true}
}).done(function (data, textStatus, jqXHR) {
console.log(data);
});