不知道爲什麼這不再陣列之間{}沒有逗號,{}不再數組JSON,以及如何提醒JSON數據jQuery中
foreach ($query->result_array() as $row) {
header("Content-type: application/json");
echo (json_encode($row,JSON_PRETTY_PRINT));
}
而如何在jQuery的提醒JSON數據? 在此之前,我用js中的循環來循環它,但由於某種原因,我現在必須在服務器端循環。
編輯
//because i want to replace $row['url'] to get_thumb();
foreach($query->result_array() as $row){
$row['url'] = $this->vz_image->get_thumb($row['url'],'n');
header("Content-type: application/json");
echo (json_encode($row,JSON_PRETTY_PRINT));
}
然後我得到了這個結果,但我不知道如何在jQuery來提醒這個JSON數據。任何幫助?
{
"id": "44",
"url": "assets\/img\/uploaded_photos\/thumbs\/1358786330_n.jpg",
"created_time": "1358786330",
"photo_id": "170",
"tag_id": "44",
"name": "Lan Yao Yeng",
"num_photo": "3"
}{
"id": "44",
"url": "assets\/img\/uploaded_photos\/thumbs\/1358711532_n.jpg",
"created_time": "1358711532",
"photo_id": "169",
"tag_id": "44",
"name": "Lan Yao Yeng",
"num_photo": "3"
}
你認爲'''來自哪裏? – SLaks