I need to call some module function using Ajax.
On the HTML page I have:
... onclick="new_CIDB_obj(this,'<?php
echo url("click_info_ajax/dir_manager/");
?>')" ...
It calls function "click_info_ajax_dir_manager" in module "click_info_ajax" and outputs its result to some element on the page. It works fine.
The problem is that I need to make another similar function.
I copied function "click_info_ajax_dir_manager", renamed it to "click_info_ajax_dir_manager_2", and changed the HTML code to:
... onclick="new_CIDB_obj(this,'<?php
echo url("click_info_ajax/dir_manager_2/");
?>')" ...
Now javascript gives a 404 error "page not found"!
I didn't change contents of the function, "click_info_ajax_dir_manager_2" and "click_info_ajax_dir_manager" are absolutely identical.
I'm not sure if hook "menu" has to do with it, but I tried it as follows:
function click_info_ajax_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array(
'path' => 'click_info_ajax/listdir_handler',
'title' => t('click info example'),
'access' => user_access('access content'),
'type' => MENU_CALLBACK,
'callback' => 'click_info_ajax_listdir_handler'
);
$items[] = array(
'path' => 'click_info_ajax/example_handler',
'title' => t('click info example'),
'access' => user_access('access content'),