UppSense17- Open Source sensor for chemical analysis based on fuoresence.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

38 lines
1.1 KiB

function get_config() {
$.getJSON('/config.json',
function(data) {
$.each(data, function(key, value){
document.getElementById(key).value = value;
if (data.StaEnable == 1) {
document.getElementById('StaEnable').checked = true;
}
else
document.getElementById('StaEnable').checked = false;
});
});
}
function post_netcfg(event) {
event.preventDefault();
var formData = {
'StaSSID' : document.getElementById('StaSSID').value,
'StaPassword' : document.getElementById('StaPassword').value,
'StaEnable' : (document.getElementById('StaEnable').checked ? 1 : 0)
};
$.ajax({
type : 'POST',
url : '/config',
contentType : 'application/json; charset=utf-8',
data : JSON.stringify(formData),
dataType : 'json'
})
}
$( document ).ready(function() {
get_config();
document.getElementById('form_netcfg').addEventListener('submit', post_netcfg);
document.getElementById('netcfg_cancel').addEventListener('click', get_config);
});