jQuery deferreds and promises - .then() vs .done()

后端 未结 10 1330
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-22 06:16

I\'ve been reading about jQuery deferreds and promises and I can\'t see the difference between using .then() & .done() for successful callbacks

10条回答
  •  盖世英雄少女心
    2020-11-22 06:51

    .done() has only one callback and it is the success callback

    .then() has both success and fail callbacks

    .fail() has only one fail callback

    so it is up to you what you must do... do you care if it succeeds or if it fails?

提交回复
热议问题