I have this script in javascript.
socket.onmessage = function (event) {
var theDiv = document.getElementById("cli");
var JSONObject = JSON.parse(event.data);
if(JSONObject.event === "console output") {
theDiv.innerHTML += "<div>" + JSONObject['args'] + "</div>";
}
};
the outcome of JSONObject['args'] is this:
>[2K [16:10:47] [Server thread/INFO]: [Server] test
The string is this
{"event":"console output","args":["\u003e\u001b[2K\r[16:10:47] [Server thread/INFO]: [Server] test"]}
How can i remove this from the string \u003e\u001b[2K\r?
i tried this but it doesn't work
socket.onmessage = function (event) {
var theDiv = document.getElementById("cli");
var JSONObject = JSON.parse(event.data.replaceAll("\u003e\u001b[2K\r", ""));
if(JSONObject.event === "console output") {
theDiv.innerHTML += "<div>" + JSONObject['args'] + "</div>";
}
};
How can I make it work? like this
{"event":"console output","args":["[16:10:47] [Server thread/INFO]: [Server] test"]}