김지완

water web base

This diff is collapsed. Click to expand it.
...@@ -17,34 +17,34 @@ ...@@ -17,34 +17,34 @@
17 <script> 17 <script>
18 18
19 $(document).ready(function(){ 19 $(document).ready(function(){
20 - $.getJSON('ex1.json', function(data){ 20 + $.getJSON('water.json', function(data){
21 var html = []; 21 var html = [];
22 22
23 $.each(data, function(i, item){ 23 $.each(data, function(i, item){
24 - console.log(item.users.length); 24 + console.log(item.product.length);
25 html.push('<div class="container">') 25 html.push('<div class="container">')
26 var cnt = 0; 26 var cnt = 0;
27 var name = ""; 27 var name = "";
28 - for(var num = 0; num < item.users.length; num++){ 28 + for(var num = 0; num < item.product.length; num++){
29 29
30 - if(name != item.users[num].name){ 30 + if(name != item.product[num].name){
31 if(num!=0){html.push('</div>')} // close col 31 if(num!=0){html.push('</div>')} // close col
32 if(num!=0){if(cnt%3==0){html.push('</div>');}} // close row 32 if(num!=0){if(cnt%3==0){html.push('</div>');}} // close row
33 if(cnt%3==0){html.push('<div class="row">');} // open row 33 if(cnt%3==0){html.push('<div class="row">');} // open row
34 34
35 cnt = cnt + 1; 35 cnt = cnt + 1;
36 html.push('<div class="col-sm">'); 36 html.push('<div class="col-sm">');
37 - html.push('<div><img src="'+item.users[num].img+'" target="_blank" width="200" height="200"></div>'); 37 + html.push('<div><img src="'+item.product[num].img+'" target="_blank" width="200" height="200"></div>');
38 - html.push('<div> 상품명 : '+item.users[num].name+'</div>'); 38 + html.push('<div> 상품명 : '+item.product[num].name+'</div>');
39 - html.push('<div> mart : '+item.users[num].mart+'</div>'); 39 + html.push('<div> mart : '+item.product[num].mart+'</div>');
40 - html.push('<div> 가격(100ml당가격) : '+item.users[num].price+'('+item.users[num].unit+')'+'</div>'); 40 + html.push('<div> 가격(100ml당가격) : '+item.product[num].price+'('+item.product[num].unit+')'+'</div>');
41 41
42 } 42 }
43 else{ 43 else{
44 - html.push('<div> mart : '+item.users[num].mart+'</div>'); 44 + html.push('<div> mart : '+item.product[num].mart+'</div>');
45 - html.push('<div> 가격(100ml당가격) : '+item.users[num].price+'('+item.users[num].unit+')'+'</div>'); 45 + html.push('<div> 가격(100ml당가격) : '+item.product[num].price+'('+item.product[num].unit+')'+'</div>');
46 } 46 }
47 - name = item.users[num].name; 47 + name = item.product[num].name;
48 48
49 } 49 }
50 html.push('</div>'); // close col 50 html.push('</div>'); // close col
......
This diff is collapsed. Click to expand it.