I have the following text returned in an xmlhttpresponse and I need to parse it by the pipe separator. It should return an array where position 0 is Block1, position 1 is the nodename json data, position 2 is the userid data.
({"body": "Block1|[{\"nodeName\":\"DIV\",\"nodeIndex\":20,\"x_offset\":131,\"y_offset\":47}]|33|7|33|[{\"UserID\":\"d8b4e408-b013-417c08aaa-7cd3658f4160_05_01_2015_21_32_46_000\",\"os\":\"Windows\",\"browser_width\":1366,\"Count\":16}}]"})
I have tried this but having a brain lapse at the moment trying to figure out the solution.
function outputResult() {
var response = invocation.responseText;
var textDiv = document.getElementById("textDiv");
textDiv.innerHTML += response;
var arr = response.body.split("|");
console.log(arr[0])
}