1

在这个模块中,我正在创建我正在实现 drupal 的自动完成,它给了我这个错误。我想不通为什么..

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: http://localhost/admin/content/searchcontent/autocomplete
StatusText: OK
ResponseText: 
localhost
@import url("http://localhost/modules/system/system.base.css?mm2qoh");
@import url("http://localhost/modules/system/system.menus.css?mm2qoh");
@import url("http://localhost/modules/system/system.messages.css?mm2qoh");
@import url("http://localhost/modules/system/system.theme.css?mm2qoh");
@import url("http://localhost/misc/ui/jquery.ui.core.css?mm2qoh");
@import url("http://localhost/themes/seven/jquery.ui.theme.css?mm2qoh");
@import url("http://localhost/misc/ui/jquery.ui.autocomplete.css?mm2qoh");
@import url("http://localhost/modules/system/system.admin.css?mm2qoh");
@import url("http://localhost/sites/all/modules/customheaderimage/css/customheaderimage_style.css?mm2qoh");
@import url("http://localhost/sites/all/modules/customheaderimage/css/customheaderimage_admin_style.css?mm2qoh");
@import url("http://localhost/sites/all/modules/custom/searchcontent/searchcontent.css?mm2qoh");
@import url("http://localhost/modules/comment/comment.css?mm2qoh");
@import url("http://localhost/modules/field/theme/field.css?mm2qoh");
@import url("http://localhost/modules/node/node.css?mm2qoh");
@import url("http://localhost/modules/search/search.css?mm2qoh");
@import url("http://localhost/modules/user/user.css?mm2qoh");
@import url("http://localhost/sites/all/modules/views/css/views.css?mm2qoh");
@import url("http://localhost/sites/all/modules/coffee/css/coffee.css?mm2qoh");
@import url("http://localhost/sites/all/modules/ctools/css/ctools.css?mm2qoh");
@import url("http://localhost/modules/toolbar/toolbar.css?mm2qoh");
@import url("http://localhost/modules/shortcut/shortcut.css?mm2qoh");
@import url("http://localhost/themes/seven/reset.css?mm2qoh");
@import url("http://localhost/themes/seven/style.css?mm2qoh");
Skip to main content
Home
Hello jake
Log out
Administrative toolbarDashboard (View and customize your dashboard.)
Content (Administer content and comments.)
Structure (Administer blocks, content types, menus, etc.)
Appearance (Select and configure your themes.)
People (Manage user accounts, roles, and permissions.)
Modules (Extend site functionality.)
Configuration (Administer settings.)
Reports (View reports, updates, and errors.)
Help (Reference for usage, configuration, and modules.)
Hide shortcuts      
Add content
Find content
Edit shortcuts  
You are hereHome            Add to Default shortcuts      
Search by Title
Show only items where
status 
anypublishednot publishedpromotednot promotedstickynot sticky
type 
anyArticleBasic page
Update options
Operation 
Publish selected contentUnpublish selected contentPromote selected content to front pageDemote selected content from front pageMake selected content stickyMake selected content not stickyDelete selected contentUpdate URL alias
TitleTypeAuthorStatusUpdatedOperations 
Update Gloabl Background 
Gloabl Background  newBasic pageadminpublished04/27/2013 - 22:21edit
delete
Update ComComp 
ComComp  newBasic pageadminpublished04/27/2013 - 13:59edit
delete
Update Sidelining 
Sidelining  newBasic pageadminpublished04/27/2013 - 12:27edit
delete
Update Zapper 
Zapper  newBasic pageadminpublished04/27/2013 - 11:54edit
delete
Update About 
About  newBasic pageadminpublished04/27/2013 - 11:49edit
delete

它只是返回页面,而不是 json 输出。它在我检查过的 firefox 和 chrome 中执行此操作。这是我实现它的其余代码。

function searchcontent_menu() {
  $items['admin/content/searchcontent/autocomplete'] = array(
    'page_callback' => 'searchcontent_autocomplete',
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  );
  return $items;
}

//This form code is in the form setup function
$form['searchcontent_box']['searchcontent_search'] = array(
  '#type' => 'textfield',
  '#default_value' => $keywords,
  '#weight' => -10,
  '#size' => 38,
  '#autocomplete_path' => 'admin/content/searchcontent/autocomplete',
);

function searchcontent_autocomplete($string = '') {
  $items = array();
  $items['about'] = 'about';
  $items['contact'] = 'contact';
  drupal_json_output($items);
}

我明确设置了要测试的项目,这样我的查询就没有问题了。任何人都可以找到导致此问题的错误吗?

谢谢。

4

0 回答 0