Access Denied when Menu CallBack Function is Called I am trying to call a function after the user clicks on an ajaxified link below.

$form['link'] = array(
  '#type' =&gt; 'item',              
  '#markup' =&gt; l(t($record-&gt;studid),'myid_print/callback', array('attributes' =&gt; array('class' =&gt; 'use-ajax'))),                                
); 


Below is my hook_menu function:

function myid_print_menu()
{  
    $items = array();   
    $items['myid_print/callback'] = array(    
        'page callback' =&gt; 'myid_print_user_page_callback', 
        'access callback'    =&gt; 'myid_print_user_access',
        'file' =&gt; 'myid_print.pages.inc',    
        'type' =&gt; MENU_CALLBACK,    
    );
    return $items;
}

function myid_print_user_access()
{      
    return TRUE;       
}


myid_print.pages.inc file:

function myid_print_user_page_callback()
{
    return 'Successful';
}


The above code throws the error below:







Where am I missing?
Your AJAX request is calling the path /drupal-7.34/myid_print/callback on the server. The path registered on your Drupal instance (assuming you're running under the drupal-7.34 directory) is /drupal-7.34/print/callback. Hence, the error you're seeing. 

If you want to pass an argument to your print callback, you should do this.

$items['print/%/callback'] = array(    
    'page callback' =&gt; 'print_user_page_callback', 
    'page arguments' =&gt; array(1),
    'access callback'    =&gt; 'print_user_access',
    'file' =&gt; 'print.pages.inc',    
    'type' =&gt; MENU_CALLBACK,    
);

function print_user_page_callback($id)
{
    return 'Successful printing '.$id;
}


Read more on hook_menu() if you'd like to understand more how module's can register paths.