using beforeSend and complete with $.post?

前端 未结 4 1283
轮回少年
轮回少年 2020-12-05 10:08

could one use the beforeSend() and complete() handlers with $.post or do you have to use $.ajax for it?

4条回答
  •  旧巷少年郎
    2020-12-05 10:44

    This will work for complete:

    var jqxhr = $.post("example.php", function() {
          alert("success");
    jqxhr.complete(function(){ alert("second complete"); });
    

    For beforeSend, you'll have to use $.ajaxSetup before calling $.post if you don't want to use $.ajax as they said before.

提交回复
热议问题