XMLHttpRequest from javascript to device cloud is denied

my HTTP request from javascript towards the device cloud is not working. If I use the URL field or a java application it all works fine. A snapshot of my code:

var xhr = new XMLHttpRequest();
xhr.open(‘GET’, “https://devicecloud.digi.com/ws/AlarmStatus”, true);

xhr.withCredentials = true;
xhr.setRequestHeader(“Authorization”, "Basic "+encodeduserpass);

The response is as given below. Does this mean that javascript is not supported by the device cloud? Or that my subscription doesn’t support it? I’ve tried many different settings in Chrome and the code for cross domain requests, but without luck. Any help would be very helpful. Thanks

XMLHttpRequest cannot load https://devicecloud.digi.com/ws/AlarmStatus. Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://xxxxxxxx’ is therefore not allowed access. The response had HTTP status code 401.