0
I don’t know much about javascript, so I did a web search and found a dynamical form code, only it shows this error http://prntscr.com/mp80qt, I have no idea what it might be.
$(function(){
$("#estados").change(function(){
var uf = $(this).val();
$.ajax({
type: "POST",
url: "exibe_cidade.php?uf="+uf,
dataType:"text",
success: function(res){
$("#cidades").children(".cidades").remove();
$("#cidades").append(res);
}
});
});
});
he interacts with this php code that was to pull a city list
<?php
require_once "func/conn.php";
$uf = $_GET['uf'];
$sql = 'SELECT * FROM tb_cidade WHERE uf = ? ORDER BY nome';
$stm = $conexao->prepare($sql);
$stm->bindValue(1, $uf);
$stm->execute();
$lista = $stm->fetchAll();
for($i=0;$i<count($lista);$i++){
$id = $lista[$i]['id'];
$nome = $lista[$i]['nome'];
echo '<option value="'.$id.'" class="cidades">'.$nome.'</option>';
}
?>
Use the jQuery https://www.w3schools.com/jquery/jquery_get_started.asp
– Valdeir Psr