我有以下似乎没有触发的 AJAX 脚本。有人可以告诉我它有什么问题吗?
表单.php
<script type = "text/javascript"> $(document).ready(function () {
$('#updatebtn1').click(function () {
$('#result1').show('slow').delay(4000).hide('slow')
$.post('process.php', $('#updateform1').serialize())
});
});
</script>
<form id="updateform1">
<div class="tbl_header">Timetable Support Website</div>Due Date:
<script>
$(function() {
$("#datepicker1").datepicker({
minDate: -0,
dateFormat: 'dd/mm/yy',
maxDate: new Date(2013, 1, 22)
})
});
</script>
<input type="text" id="datepicker1" style="width: 100px;
height: 10px;" value="18/02/2013" name="duedate" /> Status:
<select style="width: 125px;" name="status">
<option>Pending</option>
<option>----</option>
<option>Pending</option>
<option>In Progress</option>
<option>Complete</option>
</select>
<input type="hidden" name="id" value="1">
<input type="button" id="updatebtn1" value="Update" style="width: 100px;"
class="pmbtn" />
</form>
<div id="result1" style="display: none; color: red">Update successful!</div>
进程.php
<?php
$duedate = $_POST["duedate"];
$status = $_POST["status"];
$id = $_POST["id"];
$sql = "UPDATE pm_schedule SET duedate=?, status=?, id=? WHERE id=?";
$q = $pdo->prepare($sql);
$q->execute(array($duedate,$status,$id));
?>