-1

ページでリンクがクリックされた後、Ajax リクエストを送信しようとしています。私のセットアップは次のようなものです: 誰かがモーダル ポップアップを表示するリンクをクリックします。次に、「はい」をクリックしてアクションを「確認」するように求めます。「はい」をクリックすると、選択したアクションを実行する Ajax リクエストが送信されます。しかし、何らかの理由で、コードが Ajax コードをトリガーしていません。私のコードは以下の通りです:

<script type="text/javascript">
    $(document).ready(function() {
        $('#ajax-remove-completion-date').click(function() {
            $.ajax({
                type:'POST',
                url:'post-update.php',
                cache:false,
                success: function(response) {
                    $('#success-remove-completion-date').removeClass('hidden');
                }
            });
        });
    });
</script>

HTML:

<a href="#myModal1" role="button" data-toggle="modal"><i class="icon-trash"></i> Remove Completion Date</a>

<div id="myModal1" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel1" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
        <h3 id="myModalLabel3">Remove Completion Date</h3>
    </div>
    <div class="modal-body">
        <p>Are you sure you want to remove the students Completion Date?</p>
    </div>
    <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
        <button class="btn blue" data-dismiss="modal" id="ajax-remove-completion-date">Yes</button>
        <input type="hidden" name="submitted" value="remove-completion-date" />
    </div>
</div>
4

1 に答える 1

0

私はそれを考え出した。jQuery をロードする前に、jQuery コードをロードしました。私はこれをするのが嫌いです1

于 2013-08-10T18:57:08.527 に答える