Is there any analog to a 'finally' in jQuery AJAX calls?

后端 未结 6 512
北荒
北荒 2021-02-04 22:45

Is there a Java \'finally\' analogue in jQuery AJAX calls? I have this code here. In my always I throw an exception, however I ALWAYS want it to go to the

6条回答
  •  无人及你
    2021-02-04 23:46

    if you want one code definition for all ajax requests, you can do it like this

    $(document).ajaxComplete(function () {
        console.log('ajax complete on doc');
    })
    

提交回复
热议问题