ajax请求spring mvc controller,返回中文字符串显示乱码

来源:互联网 发布:dnf安图恩优化补丁 编辑:程序博客网 时间:2024/04/29 15:26

controller:

@RequestMapping("/checkName")

@ResponseBody

public String checkName(String puName){

.............

return "该用户名不存在";

}


ajax:

$.ajax({

type:'post',

url:'checkName',

data:{"puName":$("#puName").val()},

dataType:'text',---------------------------->必须改为json才不显示乱码

success:function(result){

    alert(result);

  }

}

)'

0 0
原创粉丝点击