zoukankan      html  css  js  c++  java
  • Ajax的get请求在IE浏览器中乱码问题的解决方案

     在web请求中可能涉及到ajax的get请求,参数为中文的情况。在Chrome或者Firefox下,请求正常,但IE下返回结果不对。通过比对发现,在IE浏览器下的请求参数出现了乱码。

    解决方案:

    var url = CONTROLLER_URL + "/findResourceListByPage.json";
        return $http.get(encodeURI(url + "?" + params))
        .then(function(response) {
              return {
                  'header' :[{
                       "key" : "title",
                       "name" : "资源标题"
                      }, {
                        "key" : "type",
                        "name" : "资源类型"
                      }
                   ],
        'rows' : response.data.data.resultList,
        'pagination' : response.data.data.pagination,
        "sort-by" : "activeState",
        "sort-order" : "asc"
    }
    });

     将get请求的url+param使用encodeURI方法进行转化。之后就可以正常进行参数传递了。

    人生苦短,我用python
  • 相关阅读:
    nginx启动
    java中有三种移位运算符
    easyUI属性汇总
    rose学习
    eclipse 启动到load workbench 后静止
    nvl函数
    Io 异常: Socket closed
    编译错误和运行时错误
    java 二进制编码
    MyFormat 幫助類
  • 原文地址:https://www.cnblogs.com/pigga/p/10098293.html
Copyright © 2011-2022 走看看