Spring Content type XXX 不支持

错误:Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported



对应的请求:


解决方法,修改ajax的data和contentType:

 $.ajax({
      type: "post",
      dataType : "json",
      url : url,
      data: JSON.stringify({"name":"test"}),//或者直接写字符串'{"name":"test"}',括号内一定要是双引号

      contentType: "application/json",

      success : function(){}
    })

对应的请求:

猜你喜欢

转载自blog.csdn.net/a873217486/article/details/65448223