bugfix
parent
201192d561
commit
9b01e15817
25
index.html
25
index.html
|
|
@ -175,7 +175,7 @@
|
||||||
var isConnected = false;
|
var isConnected = false;
|
||||||
var apiIsAlive = false;
|
var apiIsAlive = false;
|
||||||
// TODO: change to valid url
|
// TODO: change to valid url
|
||||||
var apiServer = "localhost:8080"
|
var apiServer = "localhost"
|
||||||
|
|
||||||
function hello_api() {
|
function hello_api() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
|
@ -188,8 +188,8 @@
|
||||||
ok_msg_conn("API-Server is running. Connection established");
|
ok_msg_conn("API-Server is running. Connection established");
|
||||||
apiIsAlive = true;
|
apiIsAlive = true;
|
||||||
},
|
},
|
||||||
error: function(data){
|
error: function(er){
|
||||||
err_msg_conn("API-Server unreachable");
|
err_msg_conn(`API-Server unreachable. Error: ${JSON.stringify(er)}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -208,8 +208,8 @@
|
||||||
isConnected = true;
|
isConnected = true;
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
error: function(data){
|
error: function(er){
|
||||||
err_msg_conn(`Cannot open web-socket with ${ip}:${port}`);
|
err_msg_conn(`Cannot open web-socket with ${ip}:${port}. Error: ${JSON.stringify(er)}`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -234,8 +234,8 @@
|
||||||
ok_msg_conn(`Successfully sent data to ${address}`);
|
ok_msg_conn(`Successfully sent data to ${address}`);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
error: function(data){
|
error: function(er){
|
||||||
err_msg_conn(`Cannot send data to ${address}`);
|
err_msg_conn(`Cannot send data to ${address}. Error: ${JSON.stringify(er)}`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -273,14 +273,9 @@
|
||||||
}
|
}
|
||||||
const address = document.getElementById('address').value;
|
const address = document.getElementById('address').value;
|
||||||
const data = document.getElementById('data').value;
|
const data = document.getElementById('data').value;
|
||||||
// wr or rd
|
const wrd = () => document.querySelector('input[type=radio]:checked')?.value === "rd";
|
||||||
const wrd = document.querySelector('input[type=radio]:checked').value;
|
|
||||||
// true or false
|
|
||||||
const inc = document.querySelector('#inc').checked;
|
const inc = document.querySelector('#inc').checked;
|
||||||
// const wr = document.getElementById('wr').value;
|
|
||||||
// const rd = document.getElementById('rd').value;
|
|
||||||
// const inc = document.getElementById('inc').value;
|
|
||||||
// console.log(`${document.querySelector('input[type=radio]:checked').value} ${document.querySelector('#inc').checked}`);
|
|
||||||
if (isConnected) {
|
if (isConnected) {
|
||||||
valid('ipAddress');
|
valid('ipAddress');
|
||||||
valid('port');
|
valid('port');
|
||||||
|
|
@ -293,7 +288,7 @@
|
||||||
ok_msg_conn(`Sending data to address ${address}`);
|
ok_msg_conn(`Sending data to address ${address}`);
|
||||||
valid('address');
|
valid('address');
|
||||||
valid('data');
|
valid('data');
|
||||||
if (!sendData(data, address, wrd, inc)) {
|
if (!sendData(data, address, wrd(), inc)) {
|
||||||
invalid('address');
|
invalid('address');
|
||||||
invalid('data');
|
invalid('data');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue