jQuery UI AutoComplete中的自定义值 [英] Custom values in jQuery UI AutoComplete

查看:224
本文介绍了jQuery UI AutoComplete中的自定义值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 jQuery UI自动完成,我不知道如何可以传递自定义值.

I'm using jQuery UI AutoComplete and I'm I wonder how I can pass along custom values.

我可以使用选项定义自定义值吗?不太清楚我应该如何使用它.目前,我正在通过传递URL中的值来解决问题",如下所示:

Can I use the Option to define custom values? Not quite sure how I should use it. Currently I'm solving the "problem" by passing along the values in the URL like this:

source: "http://mysite.com/wp-content/themes/theme1/include/jquery.search.php?limit=5",

推荐答案

您可以将源代码替换为这样的函数

you can replace source with a function, like this

source : function (request, response) {
    $.get('/yoururl/', { 'q' : request.term , 'some' : 1, 'other' : 2, 'value':3 },
          function(recv) { 
              var data = eval(recv);
             //do whatever with data to build the results 
              response(data.entities); // and pass it to response
          });
};

这篇关于jQuery UI AutoComplete中的自定义值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆