0
獲取數據我工作的jQuery的預輸入預輸入不工作從數據庫
$('#country_v1-query<?= $i ?>').typeahead({
order: "desc",
source: {
data: [
"Afghanistan", "Albania", "Algeria", "Afdorra"
]
},
callback: {
onInit: function(node) {
console.log('Typeahead Initiated on ' + node.selector);
}
}
});
我想通過數據從PHP來像
for ($i = 1; $i <= 10; $i++) {
$ar = array('apple', 'orange', 'banana', 'strawberry');
echo json_encode($ar);
我想顯示這個數據(json_encode($ AR))在類型
data:[<?php echo json_encode($ar);?>]
但是,當我包括JSON的標題,它呈現頁面爲JSON並停止加載HTM L和CSS 由於提前