为什么jQuery.ajaxSetup()不建议使用?

查看:566
本文介绍了为什么jQuery.ajaxSetup()不建议使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

jQuery文档中说ajaxSetup()不建议使用,这是为什么?用什么来更好地代替呢?

解决方案

Note: The settings specified here will affect all calls to $.ajax or Ajax-based derivatives such as $.get(). This can cause undesirable behavior since other callers (for example, plugins) may be expecting the normal default settings. For that reason we strongly recommend against using this API. Instead, set the options explicitly in the call or define a simple plugin to do so.

大意就是可能会和一些插件什么的冲突,比如插件内也用ajax什么的,会被你的ajaxSetup影响到。

这篇关于为什么jQuery.ajaxSetup()不建议使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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