我目前正在使用选择下拉列表和 jQuery 将变量传递给查询字符串:
$("#filter_1").change(function(e) {
window.location.href = '?filter_1=' + $(this).val()
});
$("#filter_2").change(function(e) {
window.location.href = '?filter_2=' + $(this).val()
});
这很好用。但是,如果您filter_2在已经传递filter_1变量之后选择,则会filter_1在查询字符串中被覆盖。我现在需要的是一种附加的方法,filter_1反之亦然filter_2。有任何想法吗?