dtg78700 2013-04-30 15:47
浏览 77

Drupal使用自动完成文本字段抛出ajax错误200?

In this module I'm creating i'm implementing drupal's autocomplete and it's giving me this error. I can't figure out why..

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

It's just returning the page, not the json output..It does this in firefox and chrome that i've checked. Here is the rest of my code to implement it.

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);
}

I explicitly set the items for testing so that there was no issue with my query. Can anyone find the error that is causing this?

Thanks.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器