[問題] Select box manipulation 問題請教@@

看板Ajax作者 (frog)時間14年前 (2012/03/21 15:13), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
我是參照http://blog.roodo.com/taikobo0/archives/8671037.html 而實做的 文章中讀取資料方式是用mysql去撈資料 由於我是用溝通service 取得xml 再把資料讀出來 所以就做了點小更改 index.php <select id="select1"> <option value="">請選擇</option> <?php $QsV = new SoapClient("http://aaa/aaa/aaa.asmx?WSDL"); $params = array('file_Type'=>'B','file'=>'0','Lang'=>'zh-tw','Level'=>'1'); $xmlRes = $QsV->getfile($params); $xmlRes = $xmlRes->getfileResult; $doc = simplexml_load_string($xmlRes); foreach ($doc->files->file as $kVal) { $xml_item_code = $kVal->item_code; $xml_item_desc = $kVal->item_desc; echo "<option value=\"".$xml_item_code."\">".$xml_item_desc."</option>"; } ?> </select> <select id="select2"> <option value="">請選擇</option> </select> <select id="select3"> <option value="">請選擇</option> </select> <input id="fullIdPath" type="hidden" value="3,8,24" /> ============================我是檔案分隔線================================= action.php <?php $QsV = new SoapClient("http://aaa/aaa/aaa.asmx?WSDL"); $data['0'] = '請選擇'; if (0 !== (int) $_GET['id'] && 0 !== (int) $_GET['lv']) { $parentId = (int) $_GET['id']; $levelNum = (int) $_GET['lv']; $params = array('file_Type'=>'B','file'=>'0','Lang'=>'zh-tw','Level'=>'1'); $xmlRes = $QsV->getfile($params); $xmlRes = $xmlRes->getfileResult; $doc = simplexml_load_string($xmlRes); foreach ($doc->files->file as $kVal) { $xml_item_code = $kVal->item_code; $xml_item_desc = $kVal->item_desc; $data[$xml_item_code] = $xml_item_desc; } } echo json_encode($data); ==================================我是分隔線================================= 把檔案修改過後 index.php的第一個select 有成功將資料讀出來 但當我選擇select任一選項後 第二個select卻什麼資料都沒跑出來 是我哪裡打錯了嗎@@? index.js 我沒有更改 就沒有將code貼上來了@@ $params 這是我要傳回service的變數 裡面的file 要丟的值是上一層所選的value Level 則是要顯示的select是第幾個 第一個select這2部分要傳遞的值是固定的 0跟1 稍微解釋一下@@ 希望能有人能幫我解惑一下... 一直無法動態取得資料 好苦惱>"< -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 210.242.153.42 ※ 編輯: jackyeah1213 來自: 210.242.153.42 (03/21 15:13)
文章代碼(AID): #1FQN-1KC (Ajax)
文章代碼(AID): #1FQN-1KC (Ajax)