2
I have a form, from which I’m trying to get the values this way, but it’s not working. Where I’m going wrong?
Jquery
<script type="text/javascript">
$(document).ready(function(){
data = $('#login-form').serialize();
$.post("validar.php", {
d: data,
},
function (d) {
console.log(data);
$('#myModal').modal('show');
});
return false;
});
</script>
Console result:
TipoAcesso=Selecione&LoginAcesso=&SenhaAcesso=
Form
<form method="post" id="login-form">
<ul>
<li>
<label>Tipo de Acesso:</label>
<select id="tipoAcesso" class="form-control" name="TipoAcesso" onChange="alterar(this.value);">
<option value="Selecione">Selecione</option>
<option value="Aluno">Aluno</option>
<option value="Responsável">Responsável</option>
<option value="Professor">Professor</option>
<option value="Coordenador">Coordenador</option>
<option value="Secretaria">Secretaria</option>
<option value="Adm. Escola">Adm. Escola</option>
</select>
</li>
<li>
<label id="texto">Login:</label>
<input required="required" type="text" name="LoginAcesso" id="username" placeholder="Matrícula" class="form-control" />
</li>
<li>
<label>Senha:</label>
<input required="required" type="password" name="SenhaAcesso" id="password" placeholder="Senha" class="form-control" />
<button type="button" id="show_password" name="show_password" class="fa fa-eye-slash" aria-hidden="true"></button>
</li>
<li class="text-right">
<button type="submit" name="submit" class="btn btn-primary">Acessar</button>
</li>
</ul>
</form>
When the page loads you already do all the serialize process and such. Is that right? wouldn’t have to have a Submit there?
– Bsalvo
Hello Bruno. I don’t know how to answer, because I don’t know how to work much with Jquery. You can help me?
– user24136