Get item with JavaScript/Rest

Hi all,

to display rich UI elements in my sitemap I use .html page where I need OH2 item values:

I use jQuery for this:

function _GetOpenHABItem(itemUrl) {
    var itemValue = null;
    $.ajax({
        url: itemUrl,
        data: {},
        async: false,
        success: function (data) {
            if (data != "NULL") {
                itemValue = data;
            }
        }
    });

    return itemValue;
}

function GetOpenHABItem(item) {
    var itemUrl = baseURL.concat("rest/items/").concat(item).concat("/state/");
    var itemValue = null;
    
    return _GetOpenHABItem(itemURL)
}

As I’m a beginner I want to avoid async; too complex for me & not required at the moment. As chrome shows me a warning I assume there must be a better way to achieve this:

Is there a simple, none deprecated way to do this?

thanks & kind regards,
Patrik

Do you now have a solution to this problem? If so, could you post it?