成功和$ .ajax的.done()方法有什么区别 [英] what is difference between success and .done() method of $.ajax

查看:704
本文介绍了成功和$ .ajax的.done()方法有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮助我吗?
我无法理解$.ajaxsuccess.done()之间的区别.

如果可能,请举例.

解决方案

简而言之,将成功回调函数与ajax函数解耦,以便稍后您可以添加自己的处理程序,而无需修改原始代码(观察者模式).

请从此处找到更多详细信息: https://stackoverflow.com/a/14754681/1049184

Can anyone help me?
I am not able to understand the difference between success and .done() of $.ajax.

If possible please give examples.

解决方案

In short, decoupling success callback function from the ajax function so later you can add your own handlers without modifying the original code (observer pattern).

Please find more detailed information from here: https://stackoverflow.com/a/14754681/1049184

这篇关于成功和$ .ajax的.done()方法有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆