我正在使用 MagicSuggest 自动完成标签。此代码完美运行:
$(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'}]";
?>
PS 这在 data:'data.json' 里面有 json 数据时有效。