In the blur event of a field, I give a select in my bank and bring a value and fill in my html. My question is how do I get more than one result or a specific result in the ajax date.
The code below works, but it only brings monthly if the customer is registered and free if he is not registered. But in addition, I want to fill in the combos with his data, the color of vehicle, model, brand automatically as well.
I tried with session, but in html it only appears if I go out and come back on the page.
// fill in client type after board is typed - input screen
$("#txtplaca").blur(function() {
var url = 'consulta_tip_cli.php';
var txtplaca = $("#txtplaca").val();
$.ajax ({
url: url,
data: {'txtplaca': txtplaca},
method: 'POST',
success: function(data) {
var msg = data;
$("#tipo").val(msg);
},
beforeSend: function(){
$("#loader").css({display:"block"});
},
complete: function(){
$("#loader").css({display:"none"});
}
});
});
My php:
<?php
include_once('status_logado.php');
require_once('db.class.php');
$placa = $_POST['txtplaca'];
$sql = "SELECT idmensalista FROM 'tbl_mensalista' join tbl_veiculo on IDMENSALISTA = id_mensalista ";
$sql = $sql."where vei_placa = '$placa'";
$objDb = new db();
$link = $objDb->conecta_mysql();
$resultado = mysqli_query($link,$sql);
$rows = mysqli_num_rows($resultado);
if($rows) {
echo "Mensalista";
} else {
echo "Avulso";
}
?>