I'm getting a call to an ajax (Bootstrap 3 + Html + PHP), what happens is that by putting the $ .ajax function, simply the events do not occur, if I put an alert there events happen normally:
Has anyone ever gone through this? is it some incompatibility with Bootstrap, or is it unknown to me?
<script>
function proximoCampo(atual, proximo){ // salta campo depois de preencher
if(atual.value.length >= atual.maxLength){
document.getElementById(proximo).focus();
}
}
function buscaProduto(){
$.ajax({
type: "POST",
url: "pdv-produto-ajax.php",
data: {codigoean: '7891111111111'},
success: function (data) {
alert(data.val);
}
});
}
</script>
-------------- HTML -------
<div class="form-group">
<label class="col-md-4 control-label" for="pdvcodigoean">Código Barras*</label>
<div class="col-md-8">
<input id="pdvcodigoean" name="pdvcodigoean" type="text" placeholder="Código Barras EAN13"
maxlength="13" class="form-control input-md" required="" autofocus
pattern=“^*[0-9]”
onkeyup="proximoCampo(this, 'pdvquantidade')"
>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="pdvquantidade">Quantidade vendida </label>
<div class="col-md-8">
<input id="pdvquantidade" name="pdvquantidade" type="text"
maxlength="13" class="form-control input-md" value="1"
pattern="[0-9]+(\.[0-9][0-9]?)?" min="0.01" max="9999999.99"
onfocus="buscaProduto()">
</div>
</div>