0
我有以下AJAX腳本似乎沒有被解僱。任何人都可以告訴我它有什麼問題嗎?jQuery AJAX腳本沒有觸發
form.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>
process.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));
?>
不要在PDO中使用'mysql_real_escape_string' – Mike
你如何確定「不解僱」? – Mike
@Mike數據庫中的值沒有被更新 – methuselah