jQuery 自动完成不起作用 - 下拉框未出现
jQuery Autocomplete not working - dropdown box not appearing
我在使用 jQuery 自动完成时遇到问题。一切似乎都工作正常,但没有出现下拉框。
HTML:
<link rel="stylesheet" href="css/bootstrap.css">
<link href="jQueryAssets/jquery.ui.core.min.css" rel="stylesheet" type="text/css">
<link href="jQueryAssets/jquery.ui.theme.min.css" rel="stylesheet" type="text/css">
<link href="jQueryAssets/jquery.ui.autocomplete.min.css" rel="stylesheet" type="text/css">
<link href="jQueryAssets/jquery.ui.menu.min.css" rel="stylesheet" type="text/css">
<script src="js/jquery-1.11.3.min.js"></script>
<script src="jQueryAssets/jquery-ui.js"></script>
<script src="jQueryAssets/jquery-ui.min.js"></script>
<script src="js/bootstrap.js"></script>
<input type="text" id="Autocomplete1">
<script src="jQueryAssets/jquery.ui-1.10.4.autocomplete.min.js"></script>
<script type="text/javascript">
$(function() {
$( "#Autocomplete1" ).autocomplete({
source: "http://localhost:8888/Szczerapraca/search.php",
autoFocus: true,
minLength: 2,
});
});
</script>
现在,当我输入数据时,数据会转到 search.php 文件:
并且在查询文件时://localhost:8888/Szczerapraca/search.php?term=boo 它返回 JSON 数组:["Booking.com", "Taboo.com"]
到目前为止一切看起来都很好,但是下拉框从未出现。
我曾尝试在 CSS 样式中将框的 z-index 更改为 1000,但没有帮助
提前致谢!
在 Firefox 调试器中检查 "response" 后(单击 "network" 选项卡,然后在发送的数据上,应该会出现其他选项),结果发现响应包括 html 之类的部分。当然,在浏览器中简单地检查 URL 时,这些并没有出现。从 search.php 文件中删除 html 部分后,一切正常。哦!
我在使用 jQuery 自动完成时遇到问题。一切似乎都工作正常,但没有出现下拉框。
HTML:
<link rel="stylesheet" href="css/bootstrap.css">
<link href="jQueryAssets/jquery.ui.core.min.css" rel="stylesheet" type="text/css">
<link href="jQueryAssets/jquery.ui.theme.min.css" rel="stylesheet" type="text/css">
<link href="jQueryAssets/jquery.ui.autocomplete.min.css" rel="stylesheet" type="text/css">
<link href="jQueryAssets/jquery.ui.menu.min.css" rel="stylesheet" type="text/css">
<script src="js/jquery-1.11.3.min.js"></script>
<script src="jQueryAssets/jquery-ui.js"></script>
<script src="jQueryAssets/jquery-ui.min.js"></script>
<script src="js/bootstrap.js"></script>
<input type="text" id="Autocomplete1">
<script src="jQueryAssets/jquery.ui-1.10.4.autocomplete.min.js"></script>
<script type="text/javascript">
$(function() {
$( "#Autocomplete1" ).autocomplete({
source: "http://localhost:8888/Szczerapraca/search.php",
autoFocus: true,
minLength: 2,
});
});
</script>
现在,当我输入数据时,数据会转到 search.php 文件:
并且在查询文件时://localhost:8888/Szczerapraca/search.php?term=boo 它返回 JSON 数组:["Booking.com", "Taboo.com"]
到目前为止一切看起来都很好,但是下拉框从未出现。
我曾尝试在 CSS 样式中将框的 z-index 更改为 1000,但没有帮助
提前致谢!
在 Firefox 调试器中检查 "response" 后(单击 "network" 选项卡,然后在发送的数据上,应该会出现其他选项),结果发现响应包括 html 之类的部分。当然,在浏览器中简单地检查 URL 时,这些并没有出现。从 search.php 文件中删除 html 部分后,一切正常。哦!