Jquery checking success of ajax post

前端 未结 5 1841
庸人自扰
庸人自扰 2020-11-27 15:30

how do i define the success and failure function of an ajax $.post?

5条回答
  •  醉酒成梦
    2020-11-27 15:53

    This style is also possible:

    $.get("mypage.html")
        .done(function(result){
            alert("done. read "+result.length+" characters.");
        })
        .fail(function(jqXHR, textStatus, errorThrown){
            alert("fail. status: "+textStatus);
        })
    

提交回复
热议问题