I am trying to print a json that this broker on my server, but i can not return the json, the chorme me of the following error:
XMLHttpRequest can not load .... Origin null is not allowed by Access-Control-Allow-Origin.
can someone help me?
the following code:`
console.log("carregando..");
var username = "admin";
var password = "password";
$.ajax({
type: 'GET',
url: 'http://localhots/api/json/broker/dest-metrics',
dataType: 'json',
headers : {Accept : "application/json","Access-Control-Allow-Origin" : "*"},
beforeSend : function(req) {
req.setRequestHeader('Authorization', "Basic " +Base64.encode(username+":"+password))
console.log("Autenticado!!");
},
success: function(data) { console.log("Sucesso!!"); },
error: function (data) {
console.log("ERRO");
},
data: {},
async: false,
cache: false,
jsonp: true
});`