An Ajax Autocomplete Textfield In Drupal 7 works in Firfox, but doesn't work in IE and Chrome. The following error appears:
An AJAX HTTP error occured. HTTP Result Code: 200 Debugging information follows.
Path: http://localhost/drupal/en/example/autocomplete
StatusText: OK
ResponseText: {"admin":"admin","alex":"alex","apple":"apple"}
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,
);
...
The output in Firefox is the following: