Skip to content

Instantly share code, notes, and snippets.

@rmurphey
Forked from codylindley/gist:466024
Created July 6, 2010 22:36
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 rmurphey/466025 to your computer and use it in GitHub Desktop.
Save rmurphey/466025 to your computer and use it in GitHub Desktop.
console.log(context.cache());
if(context.cache().recentOrders){
context.partial('templates/previous_orders/recent.mustache', PreviousOrdersView(context.cache().recentOrders), function(html) {
$('.recent_orders').html(html);
});
console.log('from cache');
}else{
var url = context.recent_orders_url(email, 5);
$.ajax({
url: url,
type: 'get',
beforeSend: function(xhr) {
context.authenticate(xhr, url);
},
success: function(orders) {
context.partial('templates/previous_orders/recent.mustache', PreviousOrdersView(orders), function(html) {
$('.recent_orders').html(html);
});
context.cache().recentOrders = orders;
console.log('not from cache');
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment