var data = {
"message":"",
"error":"false",
"human":[
{
"title":"",
"title_r":"8/23",
"msg":[
{
"name":"",
"name_r":"",
"content":"5/",
"content_r":"3-5",
"contents":"2018-02-07 19:23:37",
"contents_r":"20",
"address":"183",
"address_r":"25.36KM"
}
]
},
{
"title":"",
"title_r":"25/108",
"msg":[
{
"name":"",
"name_r":"10/",
"content":"",
"content_r":"1",
"contents":"",
"contents_r":"256",
"address":"",
"address_r":""
}
]
},
{
"title":"",
"title_r":"1/12",
"msg":[
{
"name":"",
"name_r":"10,568",
"content":"1.1 5% 10%",
"content_r":"100",
"contents":"50,000 95/",
"contents_r":"16,000",
"address":"",
"address_r":""
}
]
}
]
};
var country;
var amount;
var people;
var html_box = "";
var html_top = "";
var html_bot = "";
var object;
var count = 0;
var imgHTM="<img src="../web/img/list-img.jpg">";
for(x in data["human"]){
countPP;
object = data["human"][x];
console.log(object);
country = object["title"];
amount = object["title_r"];
people = object["msg"];
div_box = "<div class="m-content">";
div_country = "<div class="m-c_title">";
html_top += div_country+"<h1 id="attitle" class="fl">"+country+"</h1>"+"<p id="attitle_r" class="fr">"+amount+"";
html_top+="</div>";
html_bot += "<div class="m-c_content">";
for(m in people){
person = people[m];
html_bot += imgHTM;
html_bot += "<p class="m-c_top"><span class="m-c_t">"+person["name"]+"<span><span class="fr">"+person["name_r"]+"</span>";
html_bot += ""+person["content"]+"<span><span class="fr">"+person["content_r"]+"</span>
";
html_bot += ""+person["contents"]+"<span><span class="fr">"+person["contents_r"]+"</span>
";
html_bot += "<p class="address">"+person["address"]+"<span><span class="fr">"+person["address_r"]+"</span>";
html_bot += "</div>";
}
html_box += div_box+html_top+html_bot+"</div>";
}
$("-sharpcontainer").html(html_box);
I want to loop out these three sets of data to html, but for loops out repeated output like 1Magne12123.