我想在 URL 中动态添加查询字符串,这怎么可能在客户端。我可以通过 location.href 和 response.redirect 来处理它,但我不想这样做
谢谢
您可以使用jQuery BBQ库,特别是jQuery.param.queryString
方法。
如果要在 URL 中显示过滤,则必须使用 location.href,例如:
location.href = "yourpage.aspx?filter1=" + val
但是如果显示过滤不是必需的,那么您可以发送 JSON 调用并向用户显示过滤后的数据。
$(document).ready(function () {
$('a.TestClass').attr(function () {
return $(this).href() + '?test1=a&test2=b';
});
});