Error closing modal with JS

0

I have the following modal:

  <div class="modal fade" id="modaladdCuota" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog modal-sm" role="document">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
          <h4 class="modal-title" id="myModalLabel">Agregar Cargo/Cuota</h4>
        </div>
        <div class="modal-body">
        <form action=""  accept-charset="utf-8" name="form_add_cuota" id="form_add_cuota">
            <label>Fecha del Cargo/Cuota:</label>
            <input type="text" name="fecha" id="datepicker1" class="form-control" required data-value-missing="This field is required!" autocomplete="off"/>
            <label>Fecha límite de pago:</label>
            <input type="text" name="limite" id="datepicker2" class="form-control" required autocomplete="off"> 
            <label>Concepto:</label>
            <input type="text" name="concepto" id="concepto" class="form-control input-sm" required >
            <label>Categoría:</label>
            <select class="form-control" name="categoria" id="categoria" required >
              <option value="" disabled selected>Elige una opción</option>
              <option value="1">Mantenimiento</option>
              <option value="2">Extrordinaria</option>
              <option value="3">Áreas Comunes</option> 
            </select>
            <label>Monto:</label>
            <input type="number" name="monto" id="monto" class="form-control input-sm" placeholder="100.00" step="any" min="0" required >
            <label>Comentarios:</label>
            <textarea name="comentario" id="comentario" placeholder="Escribe un comentario" style="resize: none;" class="form-control input-sm" required></textarea>
        </div>
        <div class="modal-footer">
          <button class="btn btn-primary" id="new_cuota"  data-backdrop="false" >Enviar</button>
          <button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
          </form>  
        </div>           
      </div>
    </div>
  </div>

and the following JS code to send the modal data:

    $.ajax({
           type: "POST",
           url: "php/addCuota.php",
           data: frmData, // Adjuntar los campos del formulario enviado.
           contentType: false,
           processData: false,

            success:function(r){
                //alert(r);
                if(r==1){

                    alertify.success("Datos Enviados");
                    $("#modaladdCuota").hide(); //cierra el modal
                    $('.modal-backdrop').remove();//quitar fondo negro
                }else {
                    if (r==2) {//si hubo error en los datos
                        alertify.error("Error en los datos");
                    } else{
                        alertify.error("Fallo el servidor");
                    }
                }
            }
         });
       return false; // Evitar ejecutar el submit del formulario.

The problem I have is that after the modal is closed, the vertical scroll disappears and it does not allow me to scroll down until I reopen the modal or reload the page. Any ideas on how to fix it or why does it happen?

    
asked by Antonio Méndez 25.05.2018 в 23:37
source

0 answers