开发者

Custom values in jQuery UI AutoComplete

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

Can I use the Option to defin开发者_如何学JAVAe 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
          });
};


Check out http://jqueryui.com/demos/autocomplete/#remote-jsonp

That has the source for passing data to the backend.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜