jQuery ajax, wait until beforeSend animation finishes

前端 未结 3 1361
再見小時候
再見小時候 2021-01-03 06:08

HTML & CSS:

link


        
3条回答
  •  悲哀的现实
    2021-01-03 06:19

    you can do this

    //run your animation on link click, and when animation gets completed, // then start your ajax request.

    $("a").click(function () {
        $("img").fadeIn(600, function () {
            $("div").append(" | beforeSend finished | ");
             $.ajax({
                        url: "test.php",
                        contentType: "html",
                        error: function () {
                            $("div").append(" | error | ");
                        }
                    });
                    return false
                });
        });
    });
    

提交回复
热议问题