Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function cat_menu() {
- $items['ajax_node/%'] = array(
- 'page callback' => 'cat_print_json',
- 'page arguments' => array(1),
- 'type' => MENU_CALLBACK,
- 'access callback' => true
- );
- return $items;
- }
- /*
- * JSON Output of node
- */
- function cat_print_json($nid) {
- $node = node_load($nid);
- $data['body'] = $node->body['und'][0]['safe_value'];
- print drupal_json_encode($data);
- exit();
- }
- ?>
Add Comment
Please, Sign In to add comment