function url_build_query(currentUrl,param,value){
        var url = new URL(currentUrl);
        url.searchParams.set(param, value); // setting your param
        var newUrl = url.href; 
        return newUrl;
}