An AJAX autocomplete textfield in Drupal 7 doesn't work in Chrome An AJAX autocomplete textfield in Drupal 7 works in Firefox, 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' =&gt; '_module_name_autocomplete',
    'access arguments' =&gt; array('access example autocomplete'),
    'type' =&gt; 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-&gt;name] = check_plain($row-&gt;name);
  }
  // return for JS
  drupal_json_output($matches);
}

...
        $form['editclub']['club_name'] = array( 
          '#title' =&gt; t(''), 
          '#type' =&gt; 'textfield', 
          '#description' =&gt; t(''), 
          '#autocomplete_path' =&gt; 'example/autocomplete',
          '#weight' =&gt;15, 
          '#size' =&gt; 30, 
         );
...


The output in Firefox is the following:
I found out what causes AJAX error! When I turn on any module with UTF-8 encoding, it causes the error; when I change the encoding to ANSI or to UTF-8 without BOM, everything works. This encoding problem happened only in Google Chrome; in Firefox all encodings work well.