欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

url中向后台传递参数中文乱码

程序员文章站 2022-04-02 21:30:15
...

编码:


  var a = $("#hid_Dev").val();
  window.location.href = 'AccountList.aspx?dev=' + encodeURIComponent(a);//编码

  //检测跨地区登陆设备

解码:

var a = window.location.href.split('?')[1].replace("dev=", "");

var dev = decodeURIComponent(a);//解码
            
layer.alert("跨区域登录的设备:" + dev + "<br/>请联系一级BOSS获取设备**码!");