这是我为自动完成编写的 jquery 代码,我需要在 post 方法中编写一些代码
$(function(){$('#sug').autocomplete({
source:function(req,response){
$.post('sugestskul.php',{"term":req.term},function(data){
//what code should be written here to get suggestions
},'json')
},
minLength:1,
delay:500,
max:10,
});
});
从服务器返回的数据是这样的:
{"0":"Good Shepherd English Medium School","school":"Good Shepherd English Medium School"