Hello guys i having an error status 404 basically i am trying to go into another endpoint but receving error code:
There was an unexpected error (type=Bad Request, status=400).
Required request body content is missing: org.springframework.web.method.HandlerMethod$HandlerMethodParameter@2c553a08
$.ajax({
type: 'post',
url: 'guest/search',
data: JSON.stringify(formData),
contentType: 'application/json',
success: function(dataRecieved){
var dataRecieved= $.trim(dataRecieved);
//console.log(dataRecieved);
if(dataRecieved === 'true'){
$("#statusPlaceholder").html("Great rooms are available");
window.location.href="/guestReservation";
}else{
$("#statusPlaceholder").html("Sorry. Rooms are not available. Please try again").show().fadeOut(3000).css("color","red");
}
}
});
Spring mapping:
@RequestMapping(value = "/guestReservation", method = RequestMethod.GET)
public String createGuest(@RequestBody Guest guest){
// return new ResponseEntity<>(guestservice.create(gst), HttpStatus.OK);
return "guestReservation";
}
My question is how do i add a request body in window.location.href