0
have the following javascript
<script type="text/javascript">
function calculaReducao(){
var nd1 = document.getElementById("nrDentes1").value;
var nd2 = document.getElementById("nrDentes2").value;
$.post("calcularReducao?nd1=" + nd1 +"&nd2=" + nd2);
}
</script>
the cell in the table
<td><input type="button" onclick="calculaReducao();" value="Executar" /></td>
and the controller
@RequestMapping(value = "/calcularReducao", method = RequestMethod.POST)
public ModelAndView calcularReducao(double nd1, double nd2) throws IOException {
ModelAndView mv = new ModelAndView("/calculos.jsp");
double resultado = nd2/nd1;
mv.addObject("reducao", resultado);
return mv;
}
and with all this, the click of the button returns me an error 405, as if trying to make a get.
Message Request method 'GET' not supported
Description The method Received in the request-line is known by the origin server but not supported by the target Resource.
I’ll try to do as you said.?
– Rafael Perracini
Right here @Rafaelperracini, you say whether it worked or not.
– BrTkCa
not rolled, keeps giving the same problem...
– Rafael Perracini
Just to clarify, I need to use the pq button I make several calls for calculations from the same screen, so I don’t use Submit...I don’t know if the button needs to be inside a form, but I think not, since it calls the javascript function and spring bridges with the controller
– Rafael Perracini