0
Ajax自動填充文本字段在Drupal 7中,它在Firfox中工作,但在IE和Chrome中不起作用。出現 以下錯誤:Drupal 7中的Ajax自動填充文本字段在Chrome中不起作用
的AJAX HTTP時發生錯誤。 HTTP結果代碼:200調試信息如下。
路徑:http://localhost/drupal/en/example/autocomplete
狀態文本:OK
的responseText:{ 「admin」 的: 「管理員」, 「亞歷克斯」: 「亞歷克斯」, 「蘋果」: 「蘋果」}
function clubform_menu() {
$items['example/autocomplete'] = array(
'page callback' => '_module_name_autocomplete',
'access arguments' => array('access example autocomplete'),
'type' => MENU_CALLBACK
);
return $items;
}
function _module_name_autocomplete($string) {
$matches = array();
$return = db_query("SELECT name FROM users where lower(name) like '".$string."%' LIMIT 10");
// add matches to $matches
foreach ($return as $row) {
$matches[$row->name] = check_plain($row->name);
}
// return for JS
drupal_json_output($matches);
}
...
$form['editclub']['club_name'] = array(
'#title' => t(''),
'#type' => 'textfield',
'#description' => t(''),
'#autocomplete_path' => 'example/autocomplete',
'#weight' =>15,
'#size' => 30,
);
...
輸出在Firefox是如下:
檢查了Drupal 7 AJAX示例,它們在Chrome中返回相同的錯誤。 – Alex
這個怎麼樣? [http://drupal.stackexchange.com/questions/32463/create-textfieled-in-select-option-item-change][1] [1]:HTTP:// drupal.stackexchange.com/questions/32463/create-textfieled-in-select-option-item-change – zhilevan