When I press a toggle on a web application for the gear s2 (javascript), I send out an http request:
( function () {
var led001Button = document.getElementById("Led001"),
led002Button = document.getElementById("Led002");
function httpReq(theUrl){
var xmlhttp = null;
xmlhttp = new XMLHttpRequest();
// xmlhttp.onreadystatechange = function(){
// if (xmlhttp.readyState == xmlhttp.DONE){
// alert(xmlhttp.responseText);
// }
// else{
// alert(xmlhttp.statusText);
// }
// };
// xmlhttp.onerror = function(e){
// alert("onerror: " + xmlhttp.statusText);
// };
xmlhttp.open("GET", theUrl);
xmlhttp.send();
}
function checkToggle(name){
//make box2 = box1 when checked
var checkbox = document.getElementById(name);
if (checkbox.checked === true){
httpReq('http://school.thomashuster.nl/WebServer/edit.php?name='+name+'&value=1');
// console.log("set "+name+" ON");
}else{
httpReq('http://school.thomashuster.nl/WebServer/edit.php?name='+name+'&value=0');
// console.log("set "+name+" OFF");
}
}
if (led001Button) {
led001Button.addEventListener("change", function(){
checkToggle("Led001");
});
}
if (led002Button) {
console.log('test');
led002Button.addEventListener("change", function(){
checkToggle("Led002");
});
}
} () );
While emulating this on the gear s2 web emulator, everything works fine.
However, when I install it on the gear s2 itself, my webserver does not receive any requests. I have granted Internet privilege and access to my webserver in the config.xml file:
<access origin="https://www.thomashuster.nl" subdomains="true"></access>
<tizen:privilege name="http://tizen.org/privilege/internet"/>
Despite this, it's not successful. Can anyone help me figure out what I might be missing? Thank you!