1
我正在使用asp並從其他文件中獲取數據以進行自動填充。我嘗試了很多方法,但沒有選擇記錄的id值。如何獲得價值jquery自動完成?
$().ready(function() {
function formatItem(row) {
return row[0] + " (<strong>id: " + row[1] + "</strong>)";
}
function formatResult(row) {
return row[0].replace(/(<.+?>)/gi, '');
}
$("#Datt").autocomplete("get_data.asp", {
width: 600,
selectFirst: true,
scroll:false,
max: 25,
select: function(event, ui) {}
});
$("#Datt").result(function(event, data, formatted) {
if (data)
$(this).parent().next().find("Datt").val(data[1]);
window.scrollTo(0,1)
setTimeout(function() {
$("#OtherDatt").focus();
});
});
});
及以下get_data.asp代碼...
<%
qq = (Request.QueryString("q"))
set rsUrun=Server.CreateObject("ADODB.recordset")
rsUrun.Open "Select * from tbl_Customers WHERE Name like '%" & qq & "%' ORDER BY Name ASC", bag,1,3
If rsUrun.RecordCount > 0 Then
i = 1
Sinirla = 10
Do While Not rsUrun.EOF And i < (Sinirla + 1) %>
<%=rsUrun("Adi")%> <%= vbCrlf %>
<%
i = i + 1
rsUrun.MoveNext
Loop
End If
%>
感謝您的幫助...