前端js代码:

        var msg= $("#test").val();
        $.ajax({
            async : false,
            type: "post",
            url: "/push/",
            contentType:'application/json;charset=UTF-8',
            data: msg,
            error : function(request) {
            },
            success : function(data) {
                alert(data.code);
            }
        });

 

controller层代码

 

    @RequestMapping(value = "push", method = RequestMethod.POST)
    @ResponseBody
    public JSONObject pushMessage(@RequestBody String msg){
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("code",0);
        return jsonObject;
    }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-05-12
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
  • 2021-09-04
  • 2021-12-03
猜你喜欢
  • 2021-11-02
  • 2021-11-02
  • 2022-12-23
  • 2021-07-25
  • 2022-12-23
相关资源
相似解决方案