Skip to content

Instantly share code, notes, and snippets.

@csemrm
Last active October 10, 2017 18:07
Show Gist options
  • Select an option

  • Save csemrm/96407981dad495e17a57ed045fdc2f7f to your computer and use it in GitHub Desktop.

Select an option

Save csemrm/96407981dad495e17a57ed045fdc2f7f to your computer and use it in GitHub Desktop.
function onLoad(e) {
var data = {
"wireless" : JSON.stringify([{
"name" : "wlan0",
"mode" : "infrastructure",
"wps_method" : "pbc",
"authentication" : "wpa_psk",
"eap_type" : "",
"ssid" : "NAVOTA"
}, {
"mode" : "infrastructure",
"wps_method" : "pbc",
"authentication" : "wpa_psk",
"eap_type" : null,
"ssid" : "OTA_DEMO",
"wpa_psk" : "cjmgjtjrjj",
"name" : "wlan0:1"
}]),
"interface" : JSON.stringify({
"name" : "wlan0",
"enable" : true,
"static" : false,
"dhcp" : true,
"autoip" : false,
"ipMode" : "dhcp",
"ip" : "192.168.43.1",
"subnet" : "255.255.255.0",
"gateway" : "0.0.0.0",
"src_route" : true
})
};
//indicator_win.open();
var xhr = Ti.Network.createHTTPClient({
onload : function() {
//indicator_win.close();
Ti.API.info('this.responseText ' + this.responseText);
json = JSON.parse(this.responseText);
},
onerror : function(e) {
//indicator_win.close();
Ti.API.info('this.responseText onerror' + this.responseText);
},
timeout : 50000
});
Ti.API.info('data ' + JSON.stringify(data));
var url = "http://groomingapp.softvalleysolutions.com/index.php/rest/devices/add";//restURL + 'appusers/login';
Ti.API.info('url ' + url);
xhr.open('POST', encodeURI(url));
xhr.send(data);
}
$.index.open();
<Alloy>
<Window id="index" class="container" onOpen="onLoad"></Window>
</Alloy>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment