Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@alessandro-fazzi
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alessandro-fazzi/d2e4c4b32e84ea686594 to your computer and use it in GitHub Desktop.
Save alessandro-fazzi/d2e4c4b32e84ea686594 to your computer and use it in GitHub Desktop.
Wordless router ready for ajax partial rendering
.page-item#ascolta= render_partial('music/home')
.page-item#guarda
%i.fa.fa-video-camera.fa-spin
:javascript
jQuery.get('/', {ajax: 'video/home'}, function(data, textStatus, xhr) {
jQuery('#guarda').html(data);
});
<?php
if ( isset( $_GET['ajax'] ) ){
render_partial( $_GET['ajax'] );
} elseif (is_front_page()){
render_view("home/content");
} else {
render_view("posts/404");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment