How can I execute this script below, when the input label is filled in?
<script>
$(document).ready(function(){
var serie = $('#serie_maquina').val();
var grupo = $('#grupo_maquina').val();
console.log(serie);
console.log(grupo);
$.ajax({
type:'post',
url: 'info_maquina_consulta.php',
data: {
'serie':serie,
'grupo':grupo
},
erro: function(){
alert('erro');
},
success: function(data){
$("#maquina_carrega").html(data);
}
});
});
EDIT1 follow html as requested:
<form>
<div class="col-sm-6">
<div class="input-group input-group-md">
<span class="input-group-addon" id="sizing-addon1">Numero Serie</span>
<input type="text" class="form-control" name="serie_maquina" id="serie_maquina">
</div>
</div>
<div class="col-sm-6">
<div class="input-group input-group-md">
<span class="input-group-addon" id="sizing-addon1">Modelo</span>
<input type="text" class="form-control" name="grupo_maquina" id="grupo_maquina">
</div>
</div>
<button id="btn_consulta" type="button" class="btn btn-md btn-success">Pesquisar</button>
</form>