LoginSignup
9
10

More than 5 years have passed since last update.

ajaxをボタン押したときに実行したい時用メモ

Posted at
test.html
<button>テスト</button>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
    $('button').click(function () {
        // Ajax通信を開始する
        $.ajax({
            type: "POST",
            url: '/action',
            success: function() {
                console.log('成功');
            },
            error: function(){
                console.log('失敗');
            }
        })
    });
});
</script>
9
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
10