Access an item in JavaScript

In OH1 I used to access the state of items via the following javascript:
function getState(item)
var result = “”;
var url = “http://localhost:8080/rest/items/”+ item + "/state"
var request = $.ajax ({type: “GET”, crossDomain: true, url: url ,async: false});
request.done( function(data){result = “” + data;});
return result;

with OPENHAB2 I am geting a “Cross Origin block” in my browers.

“Quellübergreifende (Cross-Origin) Anfrage blockiert: Die Gleiche-Quelle-Regel verbietet das Lesen der externen Ressource auf http://localhost:8080/rest/items/Alarm_Diode/state. (Grund: CORS-Kopfzeile ‘Access-Control-Allow-Origin’ fehlt)”

I have already tried to set

org.eclipse.smarthome.cors:enable=true in the service.cfg
but this did not help.

Any idea?

Did you get anywhere with this? I’m just starting to look into accessing my item states in JS and found your query above.

the setting work after restart of browser