jquery instance of the Ajax application of the second-level linkage of the background is to do with PHP, the front desk through the Ajax way to achieve two-level linkage
database table Design Csj_trade
ID Int (one) auto_increment
Tname varchar (100)
Tradetype Int (one)
Where ID is the primary key auto-index, tname for the industry name, Tradetype as an identity, 0 o'clock, indicating that this data is a large class, not 0, but a number, this number represents the ID of its parent.
(1) Main Page
<script type= "Text/javascript" src= "/include/jquery/jquery-1.1.3.1.2881064151pack.js" ></script>
<select name= "Btrade" id= "Btrade" >
<option value= "-1" >--Industry-wide category--</option>
<?
$res 1=result ("select * from Csj_trade where tradetype=0");
while ($rs 1=mysql_fetch_array ($res 1)) {
?>
<option value= "<?= $rs 1[" id "]?>" >--<?= $rs 1["Tname"]?>--</option>
<?}? >
</select>
<span id= "Quote" >
<select name= "Strade" >
<option value= "-2" >--Industry small class--</option>
</select>
</span>
<script language= "JavaScript" >
$ ("#bTrade"). Change (function () {
$ ("#quote"). Load (".. /include/getstrade.php?id= "+$ (" #bTrade "). Val ());
});
</script>
(2) getstrade.php
<?
Require_once ("function.php");
Header ("Cache-control:no-cache");
$id =verify_id ($_get["id"]);
$res =result ("select * from Csj_trade where tradetype=". $id);
$rt = ' <select name= ' Strade "id=" S_trade ">";
while ($rs =mysql_fetch_array ($res)) {
$rt. = ' <option value= '. $rs ["id"]. ' " > '. $rs ["Tname"]. ' </option> ';
}
$rt. = ' </select> ';
Echo $rt;
?>
Query instance of the AJAX application of the second-level linkage of the background is the use of PHP to do