jquery中使用encodeURI编码了字符串,alert出来看过编码正常。
[code="java"]
var content = GetTinyMceContent("contentText");
var id = $("#contentId").val();
alert(encodeURI(content));
$.ajax({
type:'post',
dataType:'json',
contentType:'application/x-www-form-urlencoded; charset=UTF-8',
url:'updateContent?t=' + new Date().getUTCMilliseconds() + "&content.id=" + id + "&content.content=" + encodeURI(content),
success:function(data){
if(data.resultStatus == "true"){
alert("已经成功保存");
}else{
alert("保存失败");
return;
}
$("#viewPoopSheetDiv").dialog("close");
},
error:function (XmlHttpRequest, textStatus, errorThrown){
alert(XmlHttpRequest.status);
}
})
[/code]
后台ACTION中打印出来接收到的就是乱码而不是编码后的字符串,所以解码就没用了,不知道是什么原因。