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

为什么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影响到。

【热门文章】
【热门文章】