How can I get jQuery to perform a synchronous, rather than asynchronous, Ajax request?

后端 未结 14 2350
暗喜
暗喜 2020-11-21 05:07

I have a JavaScript widget which provides standard extension points. One of them is the beforecreate function. It should return false to prevent an

14条回答
  •  闹比i
    闹比i (楼主)
    2020-11-21 05:45

    This is example:

    $.ajax({
      url: "test.html",
      async: false
    }).done(function(data) {
       // Todo something..
    }).fail(function(xhr)  {
       // Todo something..
    });
    

提交回复
热议问题