下拉菜单更改 URL 重置页面

Dropdown Menu to change URL resets page

好的,所以我有一个 table,其中包含从 JSON 中提取的信息,我希望能够根据 URL 过滤 table 中显示的内容].因此,我添加了一些代码,当下拉菜单更改时(针对每个不同的过滤器),这些代码将更改 URL。它可以更改 URL(它变成 example.com?filter=memoriesexample.com?filter=booklet 或选择哪个过滤器)。唯一的事情不是继续执行并转到它应该转到的过滤器功能,而是只是重置页面而没有显示任何内容。控制台中没有错误,所以我不确定我是否只是遗漏了一些明显的东西或什么。这是执行过滤和更改 URL:

的代码
function getUrlParameter(changeURL)
{
    window.document.location.href=changeURL; 
    var sPageURL = window.location.search.substring(1);
    var sURLVariables = sPageURL.split('&');
    for (var i = 0; i < sURLVariables.length; i++) 
    {
        var sParameterName = sURLVariables[i].split('=');
        if (sParameterName[0] == null) 
        {
            filterAll();
        }
        else{
            var theChoice = sParameterName[1];
            filterChoice(theChoice);
        }
    }
}   


function filterChoice(choice){
    if(choice.value=="all"){
        clearTable();
        filterAll();
    }
    else if (choice.value=="booklet"){
        bounds = "Booklet";
        clearTable();
        filterByTimerName(bounds);
    }
    else if(choice.value=="frontier"){
        bounds = "Frontier";
        clearTable();
        filterByTimerName(bounds);
    }
    else if(choice.value=="fs"){
        bounds = "FS";
        clearTable();
        filterByTimerName(bounds);
    }
    else if(choice.value == "ft"){
        bounds = "FT";
        clearTable();       
        filterByTimerName(bounds);
    }
    else if(choice.value == "home"){
        bounds = "Home";
        clearTable();       
        filterByTimerName(bounds);
    }
    else if(choice.value == "idx"){
        bounds = "IDX";
        clearTable();
        filterByTimerName(bounds);
    }
    else if(choice.value == "login"){
        bounds = "Login";
        clearTable();
        filterByTimerName(bounds);
    }
    else if(choice.value == "memories"){
        bounds = "Memories";
        clearTable();
        filterByTimerName(bounds);
    }
    else if(choice.value == "search"){
        bounds = "Search";
        clearTable();
        filterByTimerName(bounds);
    }
    else if(choice.value == "signInPage"){
        bounds = "SignInPage";
        clearTable();
        filterByTimerName(bounds);
    }
    else if(choice.value == "signOut"){
        bounds = "SignOut";
        clearTable();
        filterByTimerName(bounds);
    }
    else if(choice.value == "temple"){
        bounds = "Temple";
        clearTable();
        filterByTimerName(bounds);
    }
}

如果能得到任何帮助,我将不胜感激!!我添加了一些图片以进行说明。 谢谢!!!

好的,我会回答我自己的问题,因为我想通了。基本上我所做的是使用一个函数来查看 URL 并解析它以查看扩展名 "filter" 是什么。然后我有一个 switch 语句来根据该过滤器做一些事情。使用 onclick 事件侦听器更改 URL 扩展。这可能不是最有效的方法,但它适合我的情况!