1
我需要在jQuery自動完成功能中解析JSON。我使用下面的代碼。JSON在jQuery自動完成功能解碼
jQuery("#name").autocomplete('<?php echo HTTP_PATH.'/songs/sss'; ?>', {
multiple: true,
mustMatch: true,
matchContains: true,
autoFill: false,
dataType: "json",
});
關於我的蛋糕控制器是
public function sss(){
$condition = array('Poet.status'=>'3');
$poet_name = $this->Poet->find('list', array('conditions' => $condition));
//pr($poet_name); exit;
echo json_encode($poet_name);
$this->autoRender = false;
}
我收到我的數據一樣簡單數組。意思是
Array(
[1]=>Abc,
[15]=>Xyz
[56]=>MNK
[77]=>skl
[85]=>qw5s
)
我該如何解析讀取和格式化後跟jquery返回的數組。