xmlHTTP
codice:
xmlHTTP = getXMLHttpRequest(); // RESTITUISCE UN ISTANZA DI XMLHttpRequest
istanzio richiamando la funzione che verifica se è firefox o altri browser...
infatto
xmlHttp == al tuo ajaxRequest
per questo non capivo prima l'uso di onreadystatechange.
perquanto riguarda questa parte :
onreadystatechange=RiempiMenu(risposta);
anche firebug mi dice che "risposta non è definita".
// JavaScript Document
var xmlHTTP = null;
codice:
function caricaProvince(regione)
{
alert("ok, sono nella funzione");
//regione_selezionata = regione.options[selectedIndex].value;
//alert(regione_selezionata);
var regione_selez = regione.options[regione.selectedIndex].value;
var url = "caricaProvince.php?regione="+ regione_selez;
alert(regione_selez);
xmlHTTP = getXMLHttpRequest();
onreadystatechange=RiempiMenu(risposta);
xmlHTTP.open("GET",url,true);
xmlHTTP.send(null);
}
function RiempiMenu(risposta)
{
alert(risposta);
}
corretto gli errori quì :
codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento senza titolo</title>
</head>
<body>
<?php
$regione = $_GET["regione"];
$connessione = mysql_connect("localhost","ispanico5","passw46.sito");
if($connessione)
{
$db = mysql_select_db("my_ispanico5");
if($db)
{
$query="SELECT Province.nome FROM Province, Regioni WHERE Regioni.id = Province.id AND Regioni.nome = '$regione'";
$result = mysql_query($query);
if($result)
{
$unnome=array();
$i = 0;
while($riga = mysql_fetch_array($result))
{
$unnome[$i] = $riga["nome"];
$i++;
//echo "<option value=\"".$riga["nome"]."\">".$riga["nome"]."</option>";
//echo "<item>
";
//echo $riga["nome"];
//echo "
</item>
";
}
implode(",",$unnome);
}
}
}
?>
</body>
</html>