I need to send a http POST to server. I have a JS like below:
mm();
function mm() {
$.ajax({
method : "POST",
contentType : "application/json",
url : "/address/sampleAddress",
dataType : "json",
timeout : 100000,
success : function(data) {
console.info("Success");
},
error : function(e) {
console.info("Error");
},
done : function(e) {
console.info("DONE");
}
});
}
And I have a Controller method:
@ResponseBody
@RequestMapping(value = "/sampleAddress", method = RequestMethod.POST)
public String wileyBillShippAddressFormValidation() {
System.out.println(this.getClass());
return "{}";
}
If I will call the mm(), then I get the folowing error:
GET https://localhost:9002/address/sampleAddress 404 (Not Found)
Could somebody explain me why? I spent more 2 hours and don't understand.