如何将Json数据传递给自动完成源变量

时间:2012-03-22 09:21:49

标签: jquery jquery-autocomplete

如何将Json数据传递给自动完成源变量。我在网格变量gridModel(sjg struts tag element)

中有json数据
        $( "#searchText" ).autocomplete({
        source: "here what should I pass"
    });

或任何其他方式获取json数据调用不需要任何ajax调用?

1 个答案:

答案 0 :(得分:0)

数据源是一个服务器端脚本,它返回JSON数据,通过source-option的简单URL指定。

有关如何传递源信息的详细信息,请访问http://jqueryui.com/demos/autocomplete/#remote

以下是一个例子:

$( "#birds" ).autocomplete({
       source: "url to call the server that returns json"
}
});