我的索引页
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Some name</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
</head>
<body>
<div class="container">
<br />
<h2 align="center">Search by name</h2><br />
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">Search</span>
<input type="text" name="search_text" id="search_text" placeholder="Enter model / search here" class="form-control" />
</div>
</div>
<br />
<div id="result"></div>
</div>
</body>
</html>
<script>
$(document).ready(function(){
load_data();
function load_data(query)
{
$.ajax({
url:"fetch.php",
method:"POST",
data:{query:query},
success:function(data)
{
$('#result').html(data);
}
});
}
$('#search_text').keyup(function(){
var search = $(this).val();
if(search != '')
{
load_data(search);
}
else
{
load_data();
}
});
});
</script>
AND MY fetch.php PAGE,用于从数据库表中获取数据并输出结果。我还添加了如果结果 > 50 它会要求输入更多字符,因为如果我不添加 if result > 50 那么我的页面需要 20 秒才能显示所有数据,因为我的数据库表有 25000 个条目。
我想要我的每个结果的 href 链接,并且在点击时,它应该从数据库表中的 ./"URL" 列下载一个文件。
我的数据库如下所示:
我当前的页面是http://mss1996.ddns.net:8008/files
我尝试在 outpur'array' 中添加 <a href=".$row["URL"]."> 但它破坏了我的页面。
海绵宝宝撒