我的sql server创建了api,如下所示
http://0.0.0.0/XHost/api/General/[{Employee_ID}]
Example: http://0.0.0.0/XHost/api/General/0123456789
我有一个像上面这样的真实IP的api。
我正在使用Codeigiter,我想通过api从sql server中获取/获取数据。
基本上我会使用jquery自动完成来提取数据。
我该如何解决?请任何建议。
答案 0 :(得分:1)
使用rest server class
为此,
从Codeigniter-restserver下载this下载,了解如何使用
并从api
致电您的jquery
,
$( "#autiId" ).autocomplete({
source: "http://0.0.0.0/XHost/api/General/0123456789",
minLength: 2,
select: function( event, ui ) {
alert("Selected: " + ui.item.value + " id " + ui.item.id : "Nothing selected, input was " + this.value );
}
});
如果您的emp id
为dynamic
,那么append
就是这样,
var id=0123456789;
和source
喜欢,
source:"http://0.0.0.0/XHost/api/General/"+id