Interface w/ REST API for push button via AJAX/Javascript

I’m using Grafana and Openhab. There is a handy Grafana plugin that allows you to use AJAX to make REST calls. I wanted to use this Ajax Grafana plugin to create a button in Grafana UI that would basically operate like a button click on one of my OpenHAB buttons.

I’m not very familiar with how the plugin structures these functions. I was wondering if I post some images of the screen on here, it might make sense to someone who can point out what I’m doing wrong? I’ll try to be as complete as possible.

This is the javascript I’m trying to replicate. You can see the “itm_all_off_fnt” is the OpenHAB item. And both Grafana and OpenHAB reside in the same Raspberry Pi.

<script type="text/javascript" language="javascript">
function UserAction() {
    var xhttp = new XMLHttpRequest();"POST", "", true);
    xhttp.setRequestHeader("Content-type", "application/json");
    var response = JSON.parse(xhttp.responseText);
<button type="submit" onclick="UserAction()">Clickme</button>

And here’s the Ajax panel. I’m unsure where to put the “OFF” content in the parameters_js field. I just don’t know what that’s suppose to be.

Notice this part under parameters field - I don’t know what OpenHAB expects.

I get this error from the AJAX panel:

This is what the plugin author offers as explanation of how to fill in the fields for the plugin.

It looks like a problem with CORS.
You need to add CORS headers to your service.

Hi did you find a way to make this work ?