2012-02-05 39 views
0

我想使用自動完成哪些調用服務器上的方法來填充列表。如何在自動完成選擇時觸發另一個Ajax請求?

對應的JS文件調用

$(function() { 
    $("#search").autocomplete(
    { 
     source: "requests/search", 
     minLength: 2, 
     select: function (event, ui) { 
      //Here I would like to send the parameters. 
      var itemid = ui.item.id; 
      alert(itemid); 
      // How to call another ajax method. 
     } 
    }) 
    }); 
+0

你試着用什麼ajax方法來代替alert.please給出完整的代碼。 – 2012-02-05 18:08:46

回答

1

調用其search方法中select事件。嘗試這個。

$(function() { 
    $("#search").autocomplete(
    { 
     source: "requests/search", 
     minLength: 2, 
     select: function (event, ui) { 
      $(this).autocomplete("search" , ui.item.value); 
     } 
    }) 
}); 
相關問題