$('#fecha_inicio').datepicker({
    language: 'es',
    autoclose: true,
    startDate: new Date(),
    endDate: new Date($('.endclass').val())
})
    .on('changeDate', function(e) {
    });

function isTextKey(evt){
    var charCode = (evt.which) ? evt.which : event.keyCode;
    if (charCode > 32 && (charCode < 65 || charCode > 90) && ( charCode < 97 || charCode > 122)  && ( charCode < 160 || charCode > 164) && charCode != 225 && charCode != 233 && charCode != 237 && charCode != 243 && charCode != 250 && charCode != 241)
        return false;
    return true;
}


$("#form-validation").validate({
    submitHandler: function (form) {
        var l = Ladda.create(document.querySelector('#submitBtn'));
        l.start();

        $.ajax({
            url: $(form).attr('action'),
            type: "POST",
            data: $(form).serialize(),
            cache: false,
            dataType: 'html',
            processData: false,
            success: function(data) {
                $('#formulario').modal('toggle');
                tableRefresh();
            },
            error: function(data) {
            },
            complete: function(data) {
            }
        });
    }
});