对于中文字,最好进行一个URL编码, 后台再解码一次//服务器端获取后要用Server.UrlDecode(Request["aa"].ToString());解码 function escape_self(text){ text = escape(text); text = text.replace(/\+/g,'%2B'); text = text.replace(/\//g,'%2F'); text = text.replace(/\?/g,'%3F'); text = text.replace(/\%/g,'%25'); text = text.replace(/\#/g,'%23'); text = text.replace(/\&/g,'%26'); return text; } function unescape_self(text){
text = text.replace(/(%2B)/g,'+'); text = text.replace(/(%2F)/g,'/'); text = text.replace(/(%3F)/g,'?'); text = text.replace(/(%25)/g,'%'); text = text.replace(/(%23)/g,'#'); text = text.replace(/(%26)/g,'&'); text = unescape(text); return text; }
加上这句
contentType:"application/x-www-form-urlencoded; charset=UTF-8",
function escape_self(text){
text = escape(text);
text = text.replace(/\+/g,'%2B');
text = text.replace(/\//g,'%2F');
text = text.replace(/\?/g,'%3F');
text = text.replace(/\%/g,'%25');
text = text.replace(/\#/g,'%23');
text = text.replace(/\&/g,'%26');
return text;
}
function unescape_self(text){
text = text.replace(/(%2B)/g,'+');
text = text.replace(/(%2F)/g,'/');
text = text.replace(/(%3F)/g,'?');
text = text.replace(/(%25)/g,'%');
text = text.replace(/(%23)/g,'#');
text = text.replace(/(%26)/g,'&');
text = unescape(text);
return text;
}