var list = function (){ $.ajax({ type: "POST", url: "../php/list.php", success: function (data) { var obj = JSON.parse(data); var str = ""; for (var i=0; i<obj.list.length; i++) { var str='<li class = "big" onclick="findList(' + obj.list[i]['id'] + ')">'; str=str + obj.list[i].ima + ' (' + obj.list[i]['count(marker.district)']; str=str + ')</li>'; } $("ul.list").html(str); } }) } list(); }
$("ul.list").html(str);