jQuery Deferred and Promise for sequential execution of synchronous and asynchronous functions

后端 未结 3 720
名媛妹妹
名媛妹妹 2020-12-14 21:19

If I want to have synchronous and asynchronous functions execute in a particular order I could use jQuery promise but it doesn\'t seem to work the way I\'d expect it to work

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-14 21:55

    Sidenote: When you use it without the array, you don't have to start with a promise. $.when({}).then(a).then(b) will do the trick just fine. You only need to make sure you don't put a inside the when.

提交回复
热议问题