Hi all,
since the last years (when the panda II was releases) I’m playing around with GHI hardware and currently I’m doing some house automation based on this hardware. Now I’m playing around with G120 to migrate to. I already got a lot of information from this forum (thanks to everybody), but now it is time for my first own post
Background:
Currently I’m building a remote web application to control the G120 software remotely. Therefore I basically use web server example from Gus (WIZnet W5100 HTTP FileServer) and jquery mobile and it works fine so far.
Problem:
For the dynamic data exchange I would like to use json and I use the following java script code:
var jqxhr = $.getJSON(“http:…”, function () {
})
.done(function () {
})
.fail(function () {
})
.always(function () {
});
This code works fine for public internet links, which provides json data, but if I change the link to my G120 IP address, only the fail method is entered.
On Server/G120 side I do not something complex, I only response some json (here from a web example):
string responseString = "{\"status\":{\"type\":\"message\",\"value\":\"Valid JSON value found\"},\"original\":{\"a\":1,\"b\":2,\"c\":3,\"d\":4,\"e\":5}}";
byte[] message = encoder.GetBytes(responseString);
response.ContentType = "application/json";
response.OutputStream.Write(message, 0, message.Length);
If I use google chrome browser with json validator or any other online json validator, the G120 response is shown as valide.
But if I do the request from java script (see above), it fails anytime.
It would be great, if somebody could help me.
Thanks for all responses!