fix in communication: use encodeURI

this is needed e.g. when command socntain blanks
This commit is contained in:
l_samenv
2024-09-27 10:49:57 +02:00
parent 69ea17aec6
commit 2e21f52071

View File

@ -247,9 +247,10 @@ function updateValues(message, src) {
function reqJSON(s, url, successHandler, errorHandler) { function reqJSON(s, url, successHandler, errorHandler) {
var xhr = typeof XMLHttpRequest != 'undefined' ? new XMLHttpRequest() var xhr = typeof XMLHttpRequest != 'undefined' ? new XMLHttpRequest()
: new ActiveXObject('Microsoft.XMLHTTP'); : new ActiveXObject('Microsoft.XMLHTTP');
url = encodeURI(url);
if (debugCommunication) { if (debugCommunication) {
console.log("%cto server (reqJSON): " + url, console.log("%cto server (reqJSON): %s",
"color:white;background:lightgreen"); "color:white;background:lightgreen", url);
} }
xhr.open('get', url, true); xhr.open('get', url, true);
xhr.onreadystatechange = function() { xhr.onreadystatechange = function() {
@ -273,9 +274,10 @@ function reqJSON(s, url, successHandler, errorHandler) {
function reqJSONPOST(s, url, parameters, successHandler, errorHandler) { function reqJSONPOST(s, url, parameters, successHandler, errorHandler) {
var xhr = typeof XMLHttpRequest != 'undefined' ? new XMLHttpRequest() var xhr = typeof XMLHttpRequest != 'undefined' ? new XMLHttpRequest()
: new ActiveXObject('Microsoft.XMLHTTP'); : new ActiveXObject('Microsoft.XMLHTTP');
url = encodeURI(url);
if (debugCommunication) { if (debugCommunication) {
console.log("%cto server (reqJSON): " + url, console.log("%cto server (reqJSON): %s",
"color:white;background:lightgreen"); "color:white;background:lightgreen", url);
} }
xhr.open('post', url, true); xhr.open('post', url, true);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");