springboot 跨域 ajax返回值跨域

    @RequestMapping(value ="/websitePositionList", method = RequestMethod.POST)
    public Map<String,Object> check2(PositionInfo positionInfo,HttpServletResponse response)throws UnsupportedEncodingException{
        response.addHeader("Access-Control-Allow-Origin", "*");
        response.addHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
        response.setHeader("Access-Control-Allow-Headers", "x-requested-with");
        response.addHeader("Access-Control-Max-Age", "1800");//30 min***
        return map;
    }


版权声明:本文为weixin_42707543原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。