解决编码问题

对于参数直接传递的

//客户端两次编码

encodeURIComponent(encodeURIComponent(workAddress))
//服务器一次解码
datas = URLDecoder.decode(datas, "UTF-8");

 

 

    var classificationUrl = baseurl
                                    + "platform/sfProjectStructureAction/buildTree.json?PROJECT_ID="
                                    + row.id + "&PROJECT_NAME=" + row.text
                                    + "&TOP=true";

        $('#classification').combotree({
                url : encodeURI(encodeURI(classificationUrl)),
                onClick : function(node) {
                    if (node.isProject && node.isProject == true) {
                        $.messager.alert('提示', '不能选择项目作为所属分类!', 'info');
                        $('#classification').combotree('setValue', '');
                        return false;
                    }
                    if (node.hasSub && node.hasSub == true) {
                        $.messager.alert('提示', '只能选择没有下级的分类作为所属分类!', 'info');
                        $('#classification').combotree('setValue', '');
                        return false;
                    }
                }
            });
//服务端

 URLDecoder.decode(PROJECT_ID, "UTF-8")

posted @ 2016-08-17 17:13  赤子之心_timefast  阅读(126)  评论(0编辑  收藏  举报