1.ajax传参数,使用ajax传递参数时尽量不要把参数拼接到URL后面,要尽量使用data进行参数传输,可以避免中文乱码和特殊字符传输的问题:
例子:
$.ajax({
url: "/zoneLogs/deletePower",
data: {id:id,permiType:permiType},
type: "post",
dataType: "json",
success: function (data) {},
error: function () {}
});
2.js前台进行编码,java后台进行解码:
例子:
js:
//点击详情
function associated2() {
var rows = grid.getSelected();
var objId = rows.OBJID;
var name = rows.NAME;
var url = "/chat/groupPersonList?objId=" + objId+"&name="+encodeURI(encodeURI((name)));
window.location.href = url;
}
java:
/**