<?php


function jeemod_chapter($nid){
  $viewmode = "chapter";

  $rep = array(
    "nid" => $nid,
    "viewmode" => $viewmode
  );

  if($nodeview = node_view(node_load($nid),$viewmode)){
    $rep = $rep+array(
      'node' => drupal_render($nodeview),
    );
    drupal_json_output($rep);
  }
}