How to load block on link click with AJAX framework? I have tried in my custom module:

Declaring a path for Ajax callback

function custom_menu() {

  $items['ajax-block/%'] = array(
    'title' =&gt; 'Ajax test callback',
    'type' =&gt; MENU_CALLBACK,
    'page callback' =&gt; 'ajax_link_callback',
    'page arguments' =&gt; array(1),
    'delivery callback' =&gt; 'ajax_deliver',
    'access arguments' =&gt; array('access content'),
  );

  return $items;
}


now the callback itself

/**
 * Callback ajax
 */
function ajax_link_callback($from_cid, $mode = NULL) {

  if ($mode != 'ajax') {
    drupal_set_message('Turn Javascript');
    drupal_goto(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '&lt;front&gt;');
  }

  $commands[] = ajax_command_html('.region-content', some_func());

  return array('#type' =&gt; 'ajax', '#commands' =&gt; $commands);
}


I have a few manually created links:

&lt;a class="use-ajax" href="/ajax-block/1/nojs"&gt;link1&lt;/a&gt;
&lt;a class="use-ajax" href="/ajax-block/2/nojs"&gt;link2&lt;/a&gt;
&lt;a class="use-ajax" href="/ajax-block/3/nojs"&gt;link3&lt;/a&gt;


Now I need such functionality - when I press link1 - block1 loads content in to .region-content, when I click link2 - block2 and etc.

How can I do this?
Looks like your missing the ajax_deliver command

$commands[] = ajax_command_html('.region-content', some_func());
$page = array('#type' =&gt; 'ajax', '#commands' =&gt; $commands);
ajax_deliver($page);