我有两个JavaScript数组:
我的AJAX代码:
Drupal PHP:
在我的控制台中,我看到
var xcoord = [];
和 var ycoord = [];
经过一些处理后,每个数组包含15个数值。我想将这些数据发送到Drupal中的菜单回调函数。我的AJAX代码:
$.post('http://mysite.com/?q=menu_example/my_page',
{'ycoord[]': ycoord, 'xcoord[]': xcoord }
);
Drupal PHP:
$items['menu_example/my_page/%/%'] = array(
'title' => 'My Page',
'description' => 'i hope this works',
'page callback' => '_graphael',
'page arguments' => array(2, 3), // fill this,
'access callback' => true,
'type' => MENU_CALLBACK,
);
在我的控制台中,我看到
xcoord
和ycoord
的值被正确传输,但回调函数却不起作用。我的问题是:如何将数组传递给菜单回调函数?我是否仍应在$items
键中使用%
占位符?