在MVC3.0项目中第一次遇到从前台的select这个HTML控件上使用AJAX传值到contorller中时汉字变成了广块的乱码,几经周折终于找到了下面的解决方案,拿来与大家分享。

function HandleBussiness(i, j, z, fileAddress) {
            if (window.confirm("Excel中包含" + z + "条记录,但是文件夹中有" + i + "个rdf文件," + j + "个本体文件吗")) {
                $.ajax({
                    type: "GET",
                    url: "ajax.aspx",
                    data: "fileAddress=" + encodeURI(fileAddress),
                    success: function (returnValue) {
                        if (returnValue == "yes") {
                            alert("上传成功");
                        }
                        else {
                            alert("上传失败");
                        }
                    }
                });
            }
        }

接收页面不用做什么任何处理。

posted on 2012-10-08 14:39  杨斐_Feil  阅读(606)  评论(0编辑  收藏  举报