I am sending a POST from ajax to a controller with Spring mvc, everything worked correctly, the controller received the data and worked with them, the problem has appeared when I wanted to execute a function in the ajax success, I have verified that enter and return error: Not Found, I do not know what can happen because it does not return to success if everything works correctly, I leave the code:
Javascript
$.ajax({
type: "POST",
url: 'http://localhost:8080/HelloSpringMVC/j',
data: {t: JSON.stringify(objeto), l: JSON.stringify(objeto2)},//put search js object directly here
success :function(result) {
// do what ever you want with data
$("#res2").text("Success");
pedirDatos();
}, error: function (xhr, status, error) {
$("#res2").text(error);
}
});
Controller
@RequestMapping(value ="/j", method = RequestMethod.POST)
public String posted(String t, String l) {
System.out.println("Tarjetas" +t);
return "sucess";
}