I am developing an application for Gear S (and later S2), which collects the data and sends them to my server via a POST request.
Here is the code for sending the data:
$.post(URL_POST_DATA,
{
data : JSON.stringify(sendingArray)
},
function(data, status){
console.log("Data: " + data + "\nStatus: " + status);
$("#status").css("background","green");
console.log("Success");
})
.fail(function(data,status){
console.log("Data: " + data + "\nStatus: " + status);
$("#status").css("background","red");
console.log("Failure");
return;
});
Basically, it should turn the background green (as well as putting a log on the console) when the transmission goes successfully, and red if there is a problem. However, the transmission never takes place. There is neither "Success" nor "Failure" on the console.
There are two odd things:
Second, the server never receives any request (not a POST or GET), despite being reachable - I checked its reachability by my phone.
Here are the javascript files I include in my application:
<script type="text/javascript" src="lib/jquery/jquery-1.11.2.js"></script>
<script type="text/javascript" src="lib/tau/wearable/js/tau.min.js"></script>
<script src="lib/idb/idbstore.min.js"></script>
Now I wonder whether I am missing something which prevents the transmission request being sent.
The code is fine and it should properly work if the access is provided. Therefore, by adding the following line in the config.xml
file, the request was sent successfully.
<access origin="*" subdomains="true"/>