开发者

Ajax autocomplete url problem

Hey Guys. I have got a problem on using the jquery auto-complete plugin.my problem is as the downside. I am using the ruby on rails framework to develop project.

    $().ready(function() {
    $("#person_name").focus().autocomplete('show_people', {multiple: false, formatItem: formatItem, width: 290}).result(function(event,item){}
  }

this is my javascript code. i am on the page ..../conversations/23. but when i use the auto-complete .the code send a req开发者_如何学Gouest to /conversations/23/show_people. i don't want it send the request .i want it send the search request to /conversations/show_people. thank you for your help!


So specify the URL as "/conversations/show_people" instead of just "show_people"


First, update your autocomplete plugin to the latest version (the latest version is in jQuery UI) :

http://jqueryui.com/demos/autocomplete

And after you've upgraded, test using the new syntax which is like :

$("#my_input").autocomplete({ source: "/url", ... });
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜