When I show a JS alert, it redirects me to the start of my page and all the information in a form is lost and what I want is to show the alert but not redirect or recharge. How can I avoid redirecting, after accepting the alert ?, the alert is the common, so I have not added any parameters
$("#btnagregarSIM").click(function() {
var cantidadTotalSim = $("#txtValorTotalSim").val();
var cantidadArticulo = $("#txtValorTotalArticulo").val();
var facturaSim = $("#txtFacturaSIM").val();
var cantidadSim = $("#txtCantidadsim").val();
var idSim = $("#cmbSim").val();
var descripcionSim = $("#cmbSim option:selected").html();
var x = parseFloat(cantidadTotalSim) + parseFloat(cantidadSim);
if (x <= cantidadArticulo) {
if (cantidadTotalSim <= cantidadArticulo) {
fn_agregarSIM(facturaSim, cantidadSim, idSim, descripcionSim);
} else {
alert("Revisa que la cantidad de SIM sea la misma que la cantidad de Articulos")
}
} else {
alert("La cantidad de SIM no puede ser mayor que la cantidad total de articulos.");
}
});