【问题标题】:How can i avoid Jquery translate `?` to `%3F`如何避免 Jquery 将 `?` 翻译成 `%3F`
【发布时间】:2020-10-09 20:23:35
【问题描述】:

我有以下 Jquery 代码可以在按钮单击时打开页面并传递一个参数,但 ? 被转换为 %3F 有没有办法解决这个问题?

$("#PrintDocument").click(function () {

    var grid = $("#Billings").data("kendoGrid");
    var row = $("input:checked", grid.tbody).closest("tr");
    var item = grid.dataItem(row);
    window.location.pathname = '/invoice/billing/Print' + '?productId=' + item.ProductID + '&' + 'runId=' + item.RunID;
   
});

【问题讨论】:

    标签: javascript jquery asp.net


    【解决方案1】:

    您正在设置没有查询字符串的路径名。

    window.location.href = '/invoice/billing/Print' + '?productId=' + item.ProductID + '&' + 'runId=' + item.RunID;
    

    【讨论】: