I am sending a JQuery AJAX request to the server, but the browser console tells me that the page was not found. However, my Spring MVC signature matching the requested URL is running, and yet donepart of the AJAX function is missing.
Here is the relevant code:
JavaScript:
var content = $(data).filter("#wrapper-email-content");
$.ajax({
url : '/sendEmail',
type : 'POST',
data : {
content: content.html()
}
}).done(function(){
console.log("Finished")
});
Spring Signature MVC:
@RequestMapping(value = "/sendEmail", method = RequestMethod.POST)
public void sendEmail(
HttpServletRequest request, String content) {
UserTO user = (UserTO) request.getSession().getAttribute("USER");
String email = user.getEmail();
String title = "Your order";
Email.sendEmail(title, email, content, null, null, null);
}
So, the email is sent in the code, which means that the sendEmail method is executed, but I still get Error 404: not found from the AJAX request, and Finish is not printed on the console.
What am I doing wrong?
source
share