标签:produces jquery addheader charset 支持 utf-8 增加 cal highlight
1、jsonp 支持get;可以跨域;
2、java 在controller中增加header:
/** * 获取用户信息 */ @ResponseBody @RequestMapping(value = "/user/getuserInfo", method = RequestMethod.POST,produces = "application/json;charset=UTF-8") public String getUserInfo(@RequestParam Map<String, Object> paramMap, HttpServletRequest request , HttpServletResponse response) { // response.addHeader("Access-Control-Allow-origin","localhost"); response.addHeader("Access-Control-Allow-Credentials","true"); response.addHeader("Access-Control-Allow-Methods","POST,GET,OPTIONS,PUT,DELETE"); response.addHeader("Access-Control-Allow-Headers","cache-control,content-type,hash-referer,x-requested-with"); log.info("get the /user/getInfo request data : " + paramMap.get("userId").toString()); JsonResultEx result = new JsonResultEx(); String username = paramMap.get("userId").toString(); }
标签:produces jquery addheader charset 支持 utf-8 增加 cal highlight
原文地址:https://www.cnblogs.com/hoge66/p/10422358.html