0
我沒有嘗試過,我的解決方案沒有奏效。jquery php mysql和json返回循環數據
在mysql中,我將能夠使用while循環來編寫它,但即時通訊嘗試通過ajax提取數據。
有人能幫助
var qString = 'country=' +country+'&continent='+continent;
$.post('/assets/inc/get-country.php', qString, function (data) {
$('#'+continent).append('<li>'+data[0].country+' '+data[0].company+'</li>');
}, "json");
中的console.log的Ajax響應上述返回以下
[{
"continent": "Europe",
"country": "Spain",
"company": "Universidade de Vigo CITI",
"comments": "We are very satisfied with the disrupter. It's equipment is very easy to use and effective in breaking cells. I also would like to thank Constant System for for the assistance provided."
}, {
"continent": "Europe",
"country": "Spain",
"company": "IPLA",
"comments": "The Constant Systems cell disruptor has made extraction of membrane proteins from Gram positives a reproducible and efficient task in our lab."
}]
我如何能得到這個顯示爲我的網頁上的李列表?
在此先感謝
編輯
$("#comments-tabs div.country a").click(function(e){
e.preventDefault();
var continent = $(this).parent().attr("id");
var country = $(this).attr("name");
console.log(continent+country);
var qString = 'country=' +country+'&continent='+continent;
$.post('/assets/inc/get-country.php', qString, function (data) {
for(company_nr in data){
$('#'+continent).append('<li>'+data[company_nr].country+' '+data[company_nr].company+'</li>')
}
}, "json");
});