AJAX append content via link on existing page I am trying to recreate the functionality of the ajax_link example in the Examples for Developers module.  Here is the code I have so far:

In animal_licence.module:

function animal_licence_menu() {
  $items['buy-animal-licence/animal'] = array(
    'page callback' =&gt; 'ajax_link_response',
    'access callback' =&gt; 'user_access',
    'access arguments' =&gt; array('access content'),
    'type' =&gt; MENU_CALLBACK,
    'file' =&gt; 'animal_licence.inc',
  );
  return $items;
}


In animal_licence.inc

function ajax_link_response($type = 'ajax') {
      if ($type == 'ajax') {
        $output = t("This is some content delivered via AJAX");
        $commands = array();
        $commands[] = ajax_command_append('#content', $output);
        $page = array('#type' =&gt; 'ajax', '#commands' =&gt; $commands);
        ajax_deliver($page);
      }
      else {
        $output = t("This is some content delivered via a page load.");
        return $output;
      }
    }


The ajax link on-page is:

&lt;a href="/buy-animal-licence/animal/nojs/" class="use-ajax ajax-processed"&gt;Click here&lt;/a&gt;


When I visit /buy-animal-licence/animal/ and click the link I get the ajax spinner and it eventually times out with the following:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /buy-animal-licence/animal/ajax/
StatusText: OK
ResponseText:...


I'm not sure where to go from here, any suggestions would be much appreciated.
you need to add the nojs uri part in your menu item like:

$items['buy-animal-licence/animal/%ctools_js']


also, to make all more clear - your type argument in the callback should default to NULL

function ajax_link_response($type = NULL) {