[問題] 關於連動式選單的問題
關於連動式選單 我參考了網路上找到的做法
我可以抓到資料庫第一個欄位的值
可是卻抓不到第二個欄位的值QQ
action.php的值一直回傳不了
我不曉得出了什麼問題
可以請大家幫我看一下嗎?謝謝
test.php
<script>
jQuery(document).ready(function(){ $('#c_name').cascade('#class1', {
ajax: { type: "GET", url: 'action.php',
data: { act: 'first', val: $('#class1').val() } },
template: function(item) { return "<option value='" +
item.Value + "'>" + item.Text + "</option>"; },
match: function(selectedValue) { return this.When == selectedValue; }});}
</script>
action.php
$list = '[';
switch ($action) {
case 'first':
$query = sprintf("SELECT DISTINCT description FROM game WHERE gamenumber=
'$parentId' AND description!='' ORDER BY description ASC");
$result = mysql_query($query, $db_link);
while ($row = mysql_fetch_assoc($result)) {
$list .= '{\'When\':\'' . $parentId . '\',\'Value\':\''
. $row["description"] . '\',\'Text\':\'' . $row["description"] . '\'},';
}
break;
}
$list .= ']';
echo $list;
謝謝 如有冒犯版規 我會自D
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.115.83.253
→
05/03 17:46, , 1F
05/03 17:46, 1F
→
05/03 17:46, , 2F
05/03 17:46, 2F
→
05/03 17:49, , 3F
05/03 17:49, 3F
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章