jQuery的,独立的注册功能,为每一个Ajax调用 [英] Jquery, register a function for every ajax call independently

查看:114
本文介绍了jQuery的,独立的注册功能,为每一个Ajax调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想一个函数要对每一个Ajax请求触发从一个文档发送,另一个函数触发时请求完成。

这code是要独立的,与code这将触发Ajax请求。

我记得它可以在prototypeJS做很容易,但我没有在jQuery的做到了这一点。

感谢

解决方案

使用 ajaxSetup

  $。ajaxSetup({
    成功:yourmethod
});
 

  

有关设置的详细信息可用于$ .ajaxSetup(),请参见 $。阿贾克斯()

I want a function to be triggered on every ajax request is sent from a document, and another function to trigger when that request is completed.

This code is to be independent with the code which triggers the ajax request.

I remember it can be done in prototypeJS easily, but I haven't done this in jquery.

Thanks

解决方案

Use ajaxSetup

$.ajaxSetup({
    success: yourmethod
});

For details on the settings available for $.ajaxSetup(), see $.ajax().

这篇关于jQuery的,独立的注册功能,为每一个Ajax调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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