gpt4 book ai didi

javascript - jquery 自动完成功能不起作用

转载 作者:行者123 更新时间:2023-12-02 17:28:48 25 4
gpt4 key购买 nike

我有这个 jquery/JS 代码:

<script type="text/javascript">
$(function() {
var availableTags = ["VoIP Extension Rental","VoIP Extension Rental","VoIP Extension Rental (Leasing Handsets)","VoIP Extension Rental","VoIP Extension Rental","VoIP Extension Rental","VoIP IVR Rental","VoIP Extension Rental. Handsets being leased for 3 years.","Multiple VoIP Call Diverts","VoIP Extension Rental","VoIP Extension Rental","VoIP Extension Rental","VoIP Extension Rental","VoIP Extension Rental","VoIP Extension Rental","VoIP Extension Rental","VoIP Extension Rental","VoIP Extension Rental","PSTN Phone Line","PSTN\/Analogue Phone Line","PSTN\/Analogue Phone Line","PSTN\/Analogue Phone Line","PSTN\/Analogue Phone Line","PSTN\/Analogue Phone Line","Integra Fibre Unlimited","Integra Fibre","Fibre Unlimited Broadband","ADSL 2+ Broadband","Integra Fibre Pro - 100Gb Download usage","ISDN30 Channels","ISDN Calling Line Identity","40 DDI Numbers","PSTN\/Analogue Phone Line (01702 330012)","VoIP Extension Rental","VoIP Extension Rental","VoIP Extension Rental","VoIP Extension Rental","VoIP Extension Rental","VoIP Extension Rental","VoIP Extension Rental","VoIP Extension Rental","Monthly PC Maintenance","Monthly PC Maintenance (Over the phone support only)","Monthly PC Maintenance","Monthly PC Maintenance","Monthly PC Maintenance","Monthly PC Maintenance","Hosted Exchange Email Accounts","Hosted Exchange Email Accounts","Hosted Exchange Email Accounts","Hosted Exchange Email Accounts","Hosted Exchange Email Accounts","Hosted Exchange Email Accounts","Hosted Exchange Email Accounts (nextlevelofmobileadventure.co.uk)","Monthly PC Maintenance","Hosted Exchange Email Accounts","Hosted Exchange Email Accounts","VoIP Extension Rental","VoIP Extension Rental","Hosted Exchange Email Accounts","VoIP Fax Extension","Integra Unlimited Fibre Connection","Integra 50 Plan (Line & Broadband) 36 month Contract","PSTN Line Rental","Integra Business Bronze","Hosted Exchange Mailboxes","VoIP Extension Rental","PSTN\/Analogue Phone Line","Monthly PC Maintenance","Integra Bundle (Line \/ Broadband \/ VoIP)","Level 4 BT Response","PSTN Phone Line","Level 4 BT Response","Integra Fibre Unlimited",null,"BT 1571 Service","VoIP Extension Rental","VoIP Extension Rental","Phone Line Rental (for Fibre)","Integra Fibre Pro","Bespoke CRM Database","Integra Starter Web Hosting","Integra Starter Web Hosting","Integra Starter Web Hosting","Integra Starter Web Hosting","Integra Starter Web Hosting","Professional Web Hosting","Integra Starter Web Hosting","Integra Starter Web Hosting","Integra Starter Web Hosting","Integra Starter Web Hosting","Hosted Exchange Email Accounts","Hosted Exchange Mailboxes","VoIP Extension Rental","Tool Room PSTN Line","VoIP Extension Rental","VoIP Extension Rental","VoIP Extension Rental","Hosted Exchange Email Accounts (tolmers.org.uk)","PSTN \/ Analogue Line Rental","PSTN \/ Analogue Line Rental","Integra Fibre Unlimited","Integra Fibre Unlimited","Integra Fibre Unlimited","PSTN Phone Line","Level 4 BT Response","Integra Professional Web Hosting","Hosted Exchange Emails Accounts","VoIP Extension Rental","VoIP Extension Rental","Hosted Exchange Email Accounts","PSTN Phone Line","Integra Fibre Unlimited","VoIP Extension Rental","Integra Fibre Pro","Hosted Exchange Mailboxes","Hosted Exchange Mailboxes","Hosted Exchange Mailboxes","Integra Fibre Pro","Business Silver Broadband","Callback Extension","VoIP Extension Rental","No Direct Debit Setup - Monthly Charge","VoIP Extension Rental","Offsite Backup - 50p per GB","VoIP Extension Rental","Business Platinum","PSTN\/Analogue Phone Line","VoIP Extension Rental","Outmail 2000","VoIP Extension Rental","VoIP Extension Rental","PSTN Line Rental","VoIP Extension Rental","VoIP Extension Rental"] //autocomplete
$(".auto").autocomplete({
source: availableTags
});
});
</script>

但它不会在我的自动完成文本输入中显示列表,如果我将上面的内容更改为:

var availableTags = ["VoIP", "VoIP2", "VoIP2"]

它工作正常并显示 3 个选项

生成列表的 PHP 代码:

<?php
$return_arr = array();
$sql="SELECT * from customer_billing ";
$rs=mysql_query($sql,$conn) or die(mysql_error());
while($result=mysql_fetch_array($rs)) {
$return_arr[] = $result["productname"];
}
?>

最佳答案

如果您删除数组中的 null,它们就会起作用

LIVE DEMO

更新

如果您不想在查询结果中获得 null 值,则必须将其(包含产品名称的行)设置为 NOT NULL .

它变成一个空的''字符串。

关于javascript - jquery 自动完成功能不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23270320/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com