Spatial Toolbox + Thingworx

I am trying to integrate Thingworx within the Spatial Toolbox by doing the following:

function putinfo(name, value){
test_box.innerText = "HERE1";
var APIKey = 'INSERT KEY';
var xmlHttp = new XMLHttpRequest();
var url = "" + name;
var propValue = {"hello": 32};
test_box.innerText = "HERE2";'GET', url, false);
xmlHttp.setRequestHeader("x-thingworx-session", "true"); 
xmlHttp.setRequestHeader("appKey", APIKey);
xmlHttp.withCredentials = true;
test_box.innerText = "HERE3";
test_box.innerText = "HERE4";
test_box.innerText = xmlHttp.responseText;
return xmlHttp.responseText;


however it is getting stuck on xmlHttp.send(). It prints HERE3 but nothing afterward. The weird part is, is that the same code works on a separate local js file on my computer but not on the index.html file for the tool. I get status code 0.

It might be a cross origin issue. I would suggest programming a new node for IoT connections. This way your connections persist within the server even if the tool is currently not visible in the toolbox.