我用过
@RequestMapping(value = "/something", method = RequestMethod.POST)
public @ResponseBody String getCPBankAccounts(@RequestBody SomeRequest someRequest)
var ajaxData={"id" : $("#id").val(),
"name" : $("#name").val(),
"age" : $("#age").val()
};
$.ajax({
type : "POST",
contentType : 'application/json; charset=utf-8',
dataType : 'json',
url: localhost:8080/something,
xhrFields: {
withCredentials: true
},
data : JSON.stringify(ajaxData),
success: function(response) {
},
error: function(xhr) {
}
});
我正在
GET request for "http://localhost:8080/something" resulted in 200 ()
2018-03-09 12:41:13 - Reading [java.lang.String] as "application/json;charset=UTF-8" using [org.springframework.http.converter.StringHttpMessageConverter@2f0ccb34]
2018-03-09 12:41:13 - Written [{"httpStatus":"INTERNAL_SERVER_ERROR","errorCode":"ERROR","status":"FAILED","errorMessage":null,"data":"Request method 'GET' not supported"}] as "application/json" using [org.springframework.http.converter.StringHttpMessageConverter@2f0ccb34]
2018-03-09 12:41:13 - Null ModelAndView returned to DispatcherServlet with name 'dispatcherServlet': assuming HandlerAdapter completed request handling
请在我出错的地方帮助我