
// helper functions


// This fuction fetch data from own api
function fetchdata(url, data){

    var data;

    $.getJSON(API + url, data, function(response){
        data = response;
    }); 

    return data;

/*
    fetch(API + url).then(response => {
        if (!response.ok) {
        throw new Error('Network response was not ok');
        }
        return response.json();
    }).then(data => {
        console.log('Data received:', data);
    }).catch(error => {
        console.error('There was a problem with the fetch operation:', error);
    });
*/
}
