一、點選出現選單
$("#edu").autocomplete({ minLength: 0, source: "<{xoAppUrl uploads/ugm_bmcc/kind_edu.json}>", }).focus(function() { $(this).autocomplete("search", $(this).val()); });
二、在有新增項目地方使用 自動完成
$("#tbin").on("focus",".unit",function(e) { if (!$(this).data("autocomplete") ) { // If the autocomplete wasn't called yet: $(this).autocomplete({ minLength: 0, source: "<{xoAppUrl}>uploads/ugm_cart/kindUnit/kindUnit.json", }).focus(function() { $(this).autocomplete("search", $(this).val()); }); } });
if($kind == "kindUnit"){ # ----得到陣列 ---------------------------- $rows = $ugmKind->get_listArr($ofsn,$level,$enable); $content =[]; foreach($rows as $row){ $content[] = $row['title']; } #---- 檢查資料夾 mk_dir(XOOPS_ROOT_PATH . "/uploads/{$module_name}/{$kind}"); $file = XOOPS_ROOT_PATH . "/uploads/{$module_name}/{$kind}/{$kind}.json"; $f = fopen($file, 'w'); //以寫入方式開啟文件 fwrite($f, json_encode($content, JSON_UNESCAPED_UNICODE)); //將新的資料寫入到原始的文件中 fclose($f); }