我正在使用MagicSuggest自動完成標籤。 此代碼的工作完美:MagicSuggest以PHP失敗
$(document).ready(function() {
var ms3 = $('#ms3').magicSuggest({
data: [{id:12,name:'php'},{id:1212,name:'java'},{id:112,name:'python'},{id:125,name:'html'},{id:172,name:'css'}]
});
});
但是這一次沒有:
$(document).ready(function() {
var ms3 = $('#ms3').magicSuggest({
data:'data.php'
});
});
PHP:
<?php
echo "[{id:12,name:'php'},{id:1212,name:'java'},{id:112,name:'python'},{id:125,name:'html'},{id:172,name:'css'}]";
?>
附:這適用於data:'data.json'內部帶有json數據的情況。
http://stackoverflow.com/questions/15488053/magicsuggest-dynamic-ajax-source – Robert 2013-04-29 10:25:53