wait for a jquery ajax callback from calling function

后端 未结 4 1640
悲哀的现实
悲哀的现实 2020-11-27 07:01

I have reviewed a lot of answers to this type of question and now I am confused as to the best way. Given the latest jquery, I am wanting to

  1. Call an ajax funct
4条回答
  •  离开以前
    2020-11-27 07:35

    The answer is you don't, but it is easily achievable. The idea of AJAX is it is asynchronous, hence the A JAX. This means that the function that originally calls your ajax will not wait for it to complete and instead all work to be completed after an ajax call should be in the success or error handlers.

    If you need something to be synchronous you can change your flag from async:true to async:false but then it becomes really a SJAX call (not even sure the term exists but, technically it isnt an AJAX call anymore).

提交回复
热议问题