function doAjaxQuery(data, func) {

    const options = {
        method: 'POST',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
        body: new URLSearchParams(data).toString()
    };

    fetch(ajaxurl, options)
        .then(response => {
            return response.json()
        })
        .then(response_data => {
            func(response_data);
        });
}