工作表格阿賈克斯不是在Drupal 6
$form['assignJob'] = array(
'#type' => 'checkbox',
'#title' => 'AssignJob',
'#default_value' => 1,
'#suffix'=>"<script>$js</script>"
)
在$ JS我定義的JS。
$js = <<<EOJS
Drupal.behaviors.checkboxrender = function(context) {
$('#edit-assignJob', context).change(function(event, ui) {
var method = $(this).val();
if(method){
$.get('/assignJob/',null,responseDetails);
}
});
var responseDetails=function(response){
alert(response);
}
};
EOJS;
在定義的菜單
$items['assignJob'] = array(
'page callback' => 'assignee',
'type' => MENU_CALLBACK,
'access arguments' => array('access administration'),
);
return $items;
function assignee() {
$output='xxxx';
return drupal_json(array('status' => TRUE, 'data' => $output));
drupal_exit();
}
hook_menu所以每當我在複選框點擊返回我的空白值。任何人都可以幫忙嗎??
當我使這個我得到warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'assignee' not found or invalid function name in C:\Server\www\drupal-final\includes\menu.inc on line 350.