Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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');
- }
- });
- }
Add Comment
Please, Sign In to add comment