I'm creatring a cordova-appache application where I communicate with a web server (get and post http request to http://192.168.1.1/cgi/json/****)
in my code javascript I'm using xhr , when I send the first get request, the server respond me with json response and give me a session id and I follow response with wireshark,
the fisrt problem http.status return 0
the second problem in the console log i had this message Reason: CORS header 'Access-Control-Allow-Origin' missing.
I added this in config.xml
<allow-navigation href="http://*/*"/>
<allow-navigation href="https://*/*"/>
<allow-navigation href="data:*"/>
And this to javascript code :
http.open('GET', request_field, true);
http.setRequestHeader("Access-Control-Allow-Origin", "*");
http.setRequestHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
http.setRequestHeader("Access-Control-Allow-Methods","POST, GET, OPTIONS, DELETE, PUT, HEAD");
http.send();
Like environment i'm using: ubuntu cordova version: 6.1.1 nodejs version :v0.10.25 and Firefox