2011-09-21 64 views

回答

1

對於任何人在未來閱讀本 - 從Drupal forums

(function($) { 
    $(document).ready(function() { 
     var selector = '#main-menu li a'; // Or whatever selector you need 
     $(selector).click(function(e) { 
      e.preventDefault(); 
      $.ajax({ 
       url: $(this).attr('href') + '?ajaxrequest', 
       success: function(data) { 
        // I'm assuming here that the wrapper around your content region 
        // will be given an ID of 'region-content', you'll need to check that 
        $('#region-content').replaceWith(data); 
       } 
      }); 
     }); 
    }); 
})(jQuery); 

和模塊中:

<?php 
function mymodule_page_alter(&$page) { 
    if (isset($_GET['ajaxrequest'])) { 
     echo render($page['content']); 
     drupal_exit(); 
    } 
} 
?> 

爲我工作有一些調整。