少し問題があります。<div>
そのため、で変更が検出された後、Ajaxを使用して別のページのコンテンツをにロードしてい<select>
ます。<div>
しかし、重要なのは、その外部ページからメインページに特定のものだけをロードしたいということです。メインページのコードは次のとおりです。
<script type="text/javascript">
$(function(){
createListeSelectWithDefault("categorie", <?php echo getJsCategorieListe()?>);
});
function showListes(str)
{
if (str=="")
{
document.getElementById("txtHint").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","liste_result?q="+str,true);
xmlhttp.send();
}
</script>
<div id="content">
<div id="bloc">
<div id="title">Combiner</div>
<div class="mx">
<form name="new_combiner">
<select id="categorie" name="categorie" onchange="showListes(this.value)"></select>
</form>
</div>
<div class="mx">
<div id="txtHint">
</div>
</div>
</div>
</div>
そして、これが私の外部ページです:
<html>
<div> some other kind of text, no need to post it here, but can't take it away</div>
<div id="mainDiv">
<?php
$q=$_GET["q"];
$liste = getListeByCategorie($q);
echo "<table border='1'>
<tr>
<th>Titre</th>
<th>Vues</th>
</tr>";
foreach($liste as $row)
{
echo "<tr>";
echo "<td>" . $row->titre() . "</td>";
echo "<td>" . $row->vue() . "</td>";
echo "</tr>";
}
echo "</table>";
?>
</div>
<div> some other kind of text, no need to post it here, but can't take it away</div>
それで、あなたは行きます、それ以上は何もありません。私は何をすべきか?<div id="mainDiv">
を自分のページにロードしたいだけです。