我剛剛在我的項目中嘗試fcbkcomplete,但我有麻煩調用ajax請求將結果提取到自動完成任何人都知道如何完成它?fcbkcomplete與ajax請求獲取數據
服務器端:
public static string tagFriendAutocomplete()
{
string Result = "";
string query = "select fr.FRIEND_ID,c.[USER_NAME] from clients c inner join friends fr on c.CLIENT_ID=fr.FRIEND_ID and fr.CLIENT_ID=1 and c.[USER_NAME] like '%a%' ";
DataTable dt = new SQLHelper(SQLHelper.ConnectionStrings.WebSiteConnectionString).getQueryResult(query);
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
Result += dt.Rows[i]["USER_NAME"] + ",";
}
}
return Result;
}
客戶端:
$(document).ready(function() {
$("#select3").fcbkcomplete({
//"autoCompleteFriendTag/data.txt",
addontab: true,
maxitems: 10,
input_min_size: 0,
height: 10,
cache: true,
newel: false,
select_all_text: "select"
});
});
我不知道放在哪裏了jQuery AJAX代碼的任何幫助,請我一直2天尋找一個解決方案,但可悲的是我沒有找到我的阿賈克斯代碼是:
$.ajax({
type: 'POST',
url: 'Testautocomplete.aspx/tagFriendAutocomplete',
data: "{}",
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function (data) {
return data.d.split(',');
},
error: function (xhr) {
alert("responseText: " + xhr.responseText);
}
});
看到這個http://blog.kaning.co.uk/archives/186 – 2013-04-09 12:42:43
我沒有找到我的url中的問題,您提供 – Sora 2013-04-09 12:47:00