0
Well, I’m trying to make a simple phone call AJAX (which already works), but the callback is not "triggered":
$('#negotiation-status').on('click', '#button-add-destination', function (e){
var departure = $('#input-departure').val();
var arrive = $('#input-arrive').val();
var ckb = $('#ckb-label').val();
var price = $('#input-price').val();
var saleType = $('#ckb-saleType').val();
$.ajax({
type:'POST',
dataType: 'html',
data: "departure="+departure+"&"+"arrive="+arrive,
url:'/viatge/auth/addSelectedDestination?${_csrf.parameterName}=${_csrf.token}',
sucess: function (result){
alert("Aqui ele funcionou..." + result);
},
error: function(error){
alert("Aqui ele deu erro..." + error);
}
});
e.preventDefault();
return false;
});
I am using the Spring MVC, below is the method responsible for handling the request and send a reply:
@RequestMapping(value="/addSelectedDestination", method=RequestMethod.POST)
public @ResponseBody String addSelectedDestination(@RequestParam(value="arrive", required=true) String arrive,
@RequestParam(value="departure", required=true) String departure){
DestinationRequested destinationRequested = new DestinationRequested();
destinationRequested.setArrivalDate(arrive);
destinationRequested.setDepartureDate(departure);
selectedDestination.add(destinationRequested);
return arrive + departure;
}
The problem is that the alert();
in the sucess is not fired!
You happen to be getting into the method
addSelectedDestination
correctly?– Denis C de Azevedo
yes @denisazevedo, it enters. The problem is being the same callback.
– João Manolo