Ajax htaccess request

0

I am trying to protect my files against direct access so I used htaccess only when doing an ajax request of the error or it does not allow how to solve?

My htaccess code:

<Files *.php>
 Order Deny,Allow
 Deny from all
 Allow from 127.0.0.1
</Files>

<Files index.php>
 Order Allow,Deny
 Allow from all
</Files>

My ajax:

$('form[id="login"]').submit(function() {

    alert();

    var data = new FormData(document.getElementById('login'));

    $.ajax({
      type: 'POST',
      url: 'validaLogin.php',
      data: data,
      cache: false,
      contentType: false,
      processData: false,
      dataType: 'json',
      beforeSend: function() {
        // $('#alerta').removeClass('show');
        // $('#alerta').addClass('hidden');
        $('.login100-form-btn').prop('disabled', true);
        $('.login100-form-btn').html('<i class="fa fa-spin fa-spinner"></i>');
      },
      success: function(retorno) {
      },
      error: function(xhr, status, error){
          alert(xhr.responseText);
          $('.login100-form-btn').prop('disabled', false);
          $('.login100-form-btn').html('Entrar');
      }
    });

    return false;
});
    
asked by anonymous 02.08.2018 / 15:00

0 answers