//隐藏表单

<input id="hdPeriod" name="period" type="hidden" value="" />

//js提交代码

$("#hdPeriod").val(data.Guid);
document.forms[0].submit();

//后台取值为:

Request.Params["period"]

上面代码ie9以上的都可以取到值,但就是ie9及以下不行

于是了一下js代码就可以了如下:

function changeURLArg(url, arg, arg_val) {
            var pattern = arg + '=([^&]*)';
            var replaceText = arg + '=' + arg_val;
            if (url.match(pattern)) {
                var tmp = '/(' + arg + '=)([^&]*)/gi';
                tmp = url.replace(eval(tmp), replaceText);
                return tmp;
            } else {
                if (url.match('[\?]')) {
                    return url + '&' + replaceText;
                } else {
                    return url + '?' + replaceText;
                }
            }
        }

       $("#hdPeriod").val(data.Guid);
       window.location.href = changeURLArg(window.location.href, 'period', data.Guid)

 

相关文章:

  • 2021-12-28
  • 2021-06-08
  • 2021-05-13
  • 2022-12-23
  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
  • 2022-02-09
猜你喜欢
  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
相关资源
相似解决方案