0

我见过很多例子,其中 JQuery 自动完成从后面的代码中获取 json 响应。将列表转换为 json 然后返回到客户端的字符串数组似乎有点适得其反。我在后面的代码中有一个 Web 方法,它返回我希望自动完成使用的结果列表,有没有办法从 JQuery 调用该方法(我对 JQuery 非常陌生,实际上今晚才开始搞砸它)。

     <script type="text/javascript">
    $(document).ready(function () {
        $("#txtbox").autocomplete({
           source : 

不知道从这里去哪里...

4

1 回答 1

1

在服务器端,

[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)] 
public List<RetUsers> GetSomething()
{
//populate ur list here
  return list;
}

在jQuery中,

 $("#txtbox").autocomplete({
           source : 'your url here'
于 2012-05-10T06:10:40.790 回答