I created custom module to make simple Ajax call. This module looks like this:
<?php /** * Implements hook_menu(). */ function module_ajax_contact_menu() { $items['node/get/ajax/%'] = array( 'page callback' => 'module_ajax_contact_ajax_get_ajax', // Render HTML. 'page arguments' => array(3), 'type' => MENU_CALLBACK, 'access arguments' => array('access content'), 'delivery callback' => 'module_ajax_contact_ajax_callback', ); return $items; } function module_ajax_contact_ajax_get_ajax($nid) { $node = node_load($nid); return node_view($node, 'default'); } function module_ajax_contact_ajax_callback($page_callback_result) { // Only render content $content = drupal_render($page_callback_result); // Add CSS and JS files, add some markup $html = '<html><head><title></title>' . drupal_get_css() . drupal_get_js() . '</head><body class="jquery-ajax-load">' . $content . '<script type="text/javascript" src="/sites/all/themes/pub/js/map.js"></body></html>'; print $html; // Perform end-of-request tasks. drupal_page_footer(); }
After that I make call in JS like this:
function module_ajax_contact_ajax_load(n) { $("#popup-contact").load("/node/get/ajax/" + n, function () { $("#popup-contact").foundation('open'); }); } $('.contact-link').click(function (e) { e.preventDefault(); module_ajax_contact_ajax_load(10); });
So, after content is loaded from node id 10 (in this case) Reveal from Foundation opens.
I want to add Drupal’s default throbber during the loading of this node.
Any idea how I could do it?