jQuery AJAX脚本未触发

I have the following AJAX script which doesn't seem to be firing. Can anybody please tell me what's wrong with it?

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" />&nbsp; Status:
    <select style="width: 125px;" name="status">
        <option>Pending</option>
        <option>----</option>
        <option>Pending</option>
        <option>In Progress</option>
        <option>Complete</option>
    </select>&nbsp;
    <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));
?>
查看全部
weixin_33739523
weixin_33739523
2013/02/07 02:40
  • php
  • pdo
  • ajax
  • jquery
  • 点赞
  • 收藏
  • 回答
    私信

1个回复