hook_menu() not available for ajax loaded links I'm loading a datatable and its data into a panel, through ajax. Below is the link which can add the row(entry) to favorites. When I click the link, the jquery animation is executed properly but the hook_menu and it's callback function is not being executed. It looks like the hook_menu is not 'available'

This is the link

$link = array(
    '#type' =&gt; 'link',
    '#title' =&gt; t('Favorite'),
    '#href' =&gt; 'favorite/' . $item-&gt;nid,
    '#attributes' =&gt; array(
    'class' =&gt; array('use-ajax', 'favorite_item_button'),
    ), 
);


And this is the hook_menu

function favorite_item_menu() {
  $items = array();
  $items['favorite/%'] = array(
    'title' =&gt; 'favorite item',
    'page callback' =&gt; 'favorite_item',
    'page arguments' =&gt; array(1),
    'type' =&gt; MENU_CALLBACK,
  );

  return $items;
}


Do you see any mistakes? Am I doing something wrong, forgetting something?

Advice is much appreciated.

Edit:
- no php error logs
- no js error logs

tried: sitename.com/favorite/501 - got the error 'access denied'
You need to add 'access callback' =&gt; TRUE, to your menu item.

Your menu callback should look like the following:

function favorite_item_menu() {
  $items = array();

  $items['favorite/%'] = array(
    'title' =&gt; 'favorite item',
    'page callback' =&gt; 'favorite_item',
    'page arguments' =&gt; array(1),
    'access callback' =&gt; TRUE,
    'type' =&gt; MENU_CALLBACK,
  );

  return $items;
}