Guest User

Untitled

a guest
Feb 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. showModal: function (e) {
  2. var handle = $(e.currrentTarget).data('product-handle');
  3.  
  4. if (!handle) {
  5. this.renderModal():
  6. else {
  7. this.fetchProduct(handle, this.renderModal);
  8. }
  9.  
  10. fetchProduct: function (handle, callback) {
  11. var self = this,
  12. product = this.model.get('products')[handle];
  13.  
  14. if (product) {
  15. this.model.set('product', product);
  16. callback(product);
  17. else {
  18. $.json('' + handle + '.js', function (response, data, text_status) {
  19. self.model.set('product', product);
  20. callback(response);
  21. });
  22. }
  23.  
  24.  
  25. var product = async this.fetchProduct(handle);
Add Comment
Please, Sign In to add comment