Guest User

Untitled

a guest
May 22nd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. console.log(context.cache());
  2. if(context.cache().recentOrders){
  3. context.partial('templates/previous_orders/recent.mustache', PreviousOrdersView(context.cache().recentOrders), function(html) {
  4. $('.recent_orders').html(html);
  5. });
  6. console.log('from cache');
  7. }else{
  8. var url = context.recent_orders_url(email, 5);
  9. $.ajax({
  10. url: url,
  11. type: 'get',
  12. beforeSend: function(xhr) {
  13. context.authenticate(xhr, url);
  14. },
  15. success: function(orders) {
  16. context.partial('templates/previous_orders/recent.mustache', PreviousOrdersView(orders), function(html) {
  17. $('.recent_orders').html(html);
  18. });
  19. context.cache().recentOrders = orders;
  20. console.log('not from cache');
  21. }
  22. });
  23. }
Add Comment
Please, Sign In to add comment