每次在表单上更改用户ID(onchange =“loadtable”)时,我需要帮助使jquery函数自动加载表单上的表(在id =“notes_table”上)。所以我需要一个jquery代码函数。
**表格**
<!DOCTYPE html>
<html>
<script src="http://code.jquery.com/jquery-1.10.2.js" type="text/javascript"></script>
<script src="./action/scripts/global2.js" type="text/javascript"></script>
<body>
User Id:<input type="text" name="user_id" id="user" onchange="loadtable">
<p>Note List</p>
<div id="notes_table">Lode Notes table here</div>
</body>
</html>
** query.php **
<!DOCTYPE html>
<html>
<head>
<style>
table {
width: 100%;
border-collapse: collapse;
}
table, td, th {
border: 1px solid black;
padding: 5px;
}
th {text-align: left;}
</style>
</head>
<body>
<?php
$q = $_POST['user_id'];
include '../db/connect.php';
mysqli_select_db($con,"db3");
$sql="SELECT * FROM oz2ts_call_logs WHERE member_id = '".$q."'";
$result = mysqli_query($con,$sql);
echo "<table class=\"optable\">
<tr>
<th>Device ID</th>
<th>Title</th>
<th>Note</th>
<th>Status</th>
<th>Case Number</th>
</tr>";
while($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>" . $row['device_id'] . "</td>";
echo "<td>" . $row['title'] . "</td>";
echo "<td>" . $row['description'] . "</td>";
echo "<td>" . $row['status'] . "</td>";
echo "<td>" . $row['case_number'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>
</body>
</html>