Skip to content

Instantly share code, notes, and snippets.

@balupton
Created September 21, 2010 19:25
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 balupton/590344 to your computer and use it in GitHub Desktop.
Save balupton/590344 to your computer and use it in GitHub Desktop.
Ajaxy Beginner Interface
// Option 1 - Good solution, can create a controller from this
$('.ajaxy-page').ajaxify({
controller: 'page',
request: function(){
$('#content').fadeOut();
},
response: function(){
$('#content').html(this.Response.data.content).fadeIn();
}
});
// Option 2 - Reference existing controller - redundant and useless
$('.ajaxy-page').ajaxify({
controller: 'page'
});
// Option 3 - Could build a controller from this
$('.ajaxy-page').ajaxify({
controller: 'page',
target: '#content'
});
// Option 4 - Could build a controller from this, using a hash of the selector as the controller
$('.ajaxy-page').ajaxify({
target: '#content'
});
// Option 5 - Shorthand for Option 4
$('.ajaxy-page').ajaxify('#content');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment