categroy-second-list.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. $(function(){
  2. $.ajax({
  3. url:ApiUrl+"/index.php?act=goods_class&gc_id="+GetQueryString("gc_id"),
  4. type:'get',
  5. dataType:'json',
  6. success:function(result){
  7. var html = template.render('category2', result.datas);
  8. $("#content").append(html);
  9. var category_item = new Array();
  10. $(".category-seciond-item").click(function (){
  11. var gc_id = $(this).attr('gc_id');
  12. var self = this;
  13. if(contains(category_item,gc_id)){
  14. $(this).toggleClass("open-sitem");
  15. return false;
  16. }
  17. $.ajax({
  18. url:ApiUrl+"/index.php?act=goods_class&gc_id="+gc_id,
  19. type:'get',
  20. dataType:'json',
  21. success:function(result){
  22. category_item.push(gc_id);
  23. if(result){
  24. result.datas.gc_id = gc_id;
  25. var html = template.render('category3', result.datas);
  26. $(self).append(html);
  27. $(self).addClass('open-sitem');
  28. $('.product_list').click(function(){
  29. location.href = WapSiteUrl+"/tmpl/product_list.html?gc_id="+$(this).attr('gc_id');
  30. });
  31. }else{
  32. location.href = WapSiteUrl+"/tmpl/product_list.html?gc_id="+gc_id;
  33. }
  34. }
  35. });
  36. });
  37. }
  38. });
  39. });