谁能解释为什么此自动完成功能在localhost上有效,但在上传到服务器后却不起作用?
<tr><td>Part Name: </td><td><input type="text" name="PartNum" class="auto" id="pn" style="width:250px" required></td></tr>
<script type="text/javascript">
$(function() {
$(".auto").autocomplete({
source: "autocomplete.php",
minLength: 1
});
});
</script>
autocomplete.php
<?php
$conn = new mysqli($host, $username, $password, $db);
$searchTerm = "%{$_GET['term']}%";
$select = $conn->prepare("SELECT * FROM partindex WHERE PartNum LIKE ?");
$select->bind_param('s', $searchTerm);
$select->execute();
$result= $select->get_result();
while ($row = $result->fetch_assoc())
{
$data[] = $row['PartNum'];
}
//return json data
echo json_encode($data);
?>
?>
感谢您的帮助。谢谢