maybelike ajax addr modify
Showing
1 changed file
with
8 additions
and
11 deletions
@@ -30,7 +30,9 @@ $.get('/common/goodinfo', function(data) { | @@ -30,7 +30,9 @@ $.get('/common/goodinfo', function(data) { | ||
30 | Mustache.parse(tpl); | 30 | Mustache.parse(tpl); |
31 | }); | 31 | }); |
32 | 32 | ||
33 | +var gender = $('.mobile-wrap').hasClass('boys-wrap') ? 'index' : 'girl'; | ||
33 | var isLogin = 'Y'; //TODO:是否登录,后台提供,区分走Ajax还是页面跳转 | 34 | var isLogin = 'Y'; //TODO:是否登录,后台提供,区分走Ajax还是页面跳转 |
35 | + | ||
34 | //商品收藏 | 36 | //商品收藏 |
35 | $('.goods-list').delegate('.good-islike', 'touchstart', function(e) { | 37 | $('.goods-list').delegate('.good-islike', 'touchstart', function(e) { |
36 | var $cur, $good, id, url; | 38 | var $cur, $good, id, url; |
@@ -43,16 +45,17 @@ $('.goods-list').delegate('.good-islike', 'touchstart', function(e) { | @@ -43,16 +45,17 @@ $('.goods-list').delegate('.good-islike', 'touchstart', function(e) { | ||
43 | id = $good.data('id'); | 45 | id = $good.data('id'); |
44 | 46 | ||
45 | if ($cur.hasClass('good-like')) { | 47 | if ($cur.hasClass('good-like')) { |
46 | - url = '/goods/cancelprise'; | 48 | + url = '/' + gender + '/cancelprise'; |
47 | } else { | 49 | } else { |
48 | - url = '/goods/prise'; | 50 | + url = '/' + gender + '/prise'; |
49 | } | 51 | } |
50 | 52 | ||
53 | + | ||
51 | $.ajax({ | 54 | $.ajax({ |
52 | type: 'GET', | 55 | type: 'GET', |
53 | url: url, | 56 | url: url, |
54 | data: { | 57 | data: { |
55 | - product_skn: id | 58 | + id: id |
56 | } | 59 | } |
57 | }).then(function(data) { | 60 | }).then(function(data) { |
58 | if (data.code === 200) { | 61 | if (data.code === 200) { |
@@ -67,8 +70,7 @@ $('.goods-list').delegate('.good-islike', 'touchstart', function(e) { | @@ -67,8 +70,7 @@ $('.goods-list').delegate('.good-islike', 'touchstart', function(e) { | ||
67 | 70 | ||
68 | //srcoll to load more | 71 | //srcoll to load more |
69 | $(window).scroll(function() { | 72 | $(window).scroll(function() { |
70 | - var num, | ||
71 | - ajaxUrl; | 73 | + var num; |
72 | if (end || loading) { | 74 | if (end || loading) { |
73 | return; | 75 | return; |
74 | } | 76 | } |
@@ -79,14 +81,9 @@ $(window).scroll(function() { | @@ -79,14 +81,9 @@ $(window).scroll(function() { | ||
79 | 81 | ||
80 | loading = true; | 82 | loading = true; |
81 | num = $goodList.children('.good-info').length; | 83 | num = $goodList.children('.good-info').length; |
82 | - if ($('.mobile-wrap').hasClass('boys-wrap')) { | ||
83 | - ajaxUrl = '/index/getmore'; | ||
84 | - } else { | ||
85 | - ajaxUrl = '/girl/getmore'; | ||
86 | - } | ||
87 | $.ajax({ | 84 | $.ajax({ |
88 | type: 'GET', | 85 | type: 'GET', |
89 | - url: ajaxUrl, | 86 | + url: '/' + gender + '/getmore', |
90 | data: { | 87 | data: { |
91 | page: page + 1 | 88 | page: page + 1 |
92 | } | 89 | } |
-
Please register or login to post a comment