Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- showModal: function (e) {
- var handle = $(e.currrentTarget).data('product-handle');
- if (!handle) {
- this.renderModal():
- else {
- this.fetchProduct(handle, this.renderModal);
- }
- fetchProduct: function (handle, callback) {
- var self = this,
- product = this.model.get('products')[handle];
- if (product) {
- this.model.set('product', product);
- callback(product);
- else {
- $.json('' + handle + '.js', function (response, data, text_status) {
- self.model.set('product', product);
- callback(response);
- });
- }
- var product = async this.fetchProduct(handle);
Add Comment
Please, Sign In to add comment