Recently I swapped out a GoDaddy hosting and directing the requested DNS server to another mine. The direction is pointing into a folder.
What happens is that I'm trying to make a validation by ajax login before submitting the form to actually login.
The AJAX calls and executes a php but data is not passed by POST as if they were lost in the request. However, PHP is running in the AJAX request and even returns a message as I wanted, but the data is sent through ajax as if they got anything.
I tried to send the form by post Direct and caused the same error. I'm believing in the possibility that the POST is getting lost in directing the DNS. Is it possible?
Anyway, I'm leaving the HTML, AJAX and PHP: Note: I'm using CodeIgniter. HTML:
<?php echo form_open('usuarios/login', array('method' => 'post', 'id' => 'form-login')) ?>
<div class="boxform">
<label for="loginnome">Usuário ou E-mail:</label>
<input type="text" name="loginnome" required id="loginnome" placeholder="Usuário ou E-mail" title="Usuário ou E-mail">
</div>
<div class="boxform">
<label for="loginsenha">Senha:</label>
<input type="password" name="loginsenha" required id="loginsenha" placeholder="Senha" title="Senha">
</div>
<div class="boxform">
<input type="submit" class="button submit-claro" value="Logar" title="Logar">
</div>
<?php echo form_close(); ?>
AJAX:
$('#form-login').validate({
rules: {
loginnome: {
required:true,
maxlength:100
},
loginsenha:{
required:true,
maxlength:30
}
},
submitHandler: function( form ){
$.ajax({
type : "POST",
url : get_url()+"usuarios/validar_login",
dataType : 'json',
data : {
'usuario' : $('#loginnome').val(),
'senha' : $('#loginsenha').val()
},
success : function(data){
console.log(data);
if (data.usuario === false) {
$('.msg_error p').show();
$('.msg_error p').html('');
$('.msg_error p').html('Usuario inválido');
$('#loginnome').val('').focus();
}
else {
if (data.senha === false) {
$('.msg_error p').show();
$('.msg_error p').html('');
$('.msg_error p').html('Senha incorreta');
$('#loginnome p').val('').focus();
}
else {
inicia_sessao(data.url);
}
}
}
});
//return false;
}
});
PHP:
public function validar_login()
{
$usuario = $this->input->post('usuario');
$senha = $this->input->post('senha');
$return = $this->usuario->valida_login($usuario,$senha);
$return['url'] = site_url();
echo json_encode($return); die;
}
You may have to contact your provider to resolve this as it is directly / indirectly under their control.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments