I'm trying to add 'new' or 'updated' to the links in a Menu, and one of the ways is with AJAX. But to do that, I need to add AJAX to existing node/page path following the documentation and various examples, hook_menu() successfully adds the scripts and call backs for paths that only exist in the module file
// The page that will run the command.
$items['my-custom-path/trigger-page'] = array(
'title' => 'AJAX trigger page',
'page callback' => 'my_ajax_trigger_page',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
[my_ajax_trigger_page calls add_ajax_js and works with and without clean URLs]
but when I add items for an existing node with a menu path, a page I created, and gave a URL path like 'my-toc-page' does not get registered for the AJAX calls. nothing happens - the scripts to not load on to the page at all, and the callbacks silently fail I have also tried this with a View, with AJAX enabled, but still it does not register
// register script load
$items['test-toc-page'] = array(
'title' => 'MyTable of Contents',
'page callback' => 'add_ajax_js',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
How do you do this on a page that already exists and has content and blocks on it? No forms, but the links on the page need to be processed.
Using a page template file , I can load the JavaScript files onto an existing page, but the AJAX call backs fail.
Thanks everyone, this is a continuation of my initial question about AJAX on page load. Existing Page not getting registered by hook_menu to trigger Drupal AJAX on page load