Good morning, someone can help me with the following problem, I want to send data from two fields, one of type text and another of type select option and I want when I click on the selection do the post. Here is my code.
HTML
<form method="post" action="">
<input type="text" name="nome" onChange="Enviar(this.value);" >
<select name="sexo" onchange="">
<option value="">selecionar...</option>
<option value="M">M</option>
<option value="F">F</option>
</select>
</form>
Javascript
<script>
function getState() {
$.ajax({
method: "post",
url: "pag.php",
data: $("#form").serialize(),
});
}
</script>
And on page pag.php
PHP
But it does not work out