Created
September 21, 2010 19:25
-
-
Save balupton/590344 to your computer and use it in GitHub Desktop.
Ajaxy Beginner Interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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