这是我为自动完成编写的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"