如果检测HTTP方法(POST,GET)的jQuery.ajaxComplete() [英] Detect if HTTP method (POST, GET) in jQuery.ajaxComplete()
本文介绍了如果检测HTTP方法(POST,GET)的jQuery.ajaxComplete()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 jQuery.ajaxComplete()
如何检测HTTP方法,特别是一个GET或POST的?
In a jQuery.ajaxComplete()
how can I detect the HTTP method, specifically a GET or a POST?
我试着读了jQuery文档和摸索,我似乎无法找到传递给函数处理程序的3个对象的内部
I've tried reading the jQuery documentation and searching around and I can't seem to find much documentation of the 3 objects passed to the function handler inside
jQuery(element).ajaxComplete(function(event, request, settings) { });
感谢
推荐答案
在AJAX回调的设置
对象是设置对象被传递到了AJAX调用。因此,你可以看看就可以了键入
属性,查看它是否是GET或POST:
The settings
object in the AJAX callback is the settings object that was passed into the AJAX call. You can therefore look for the type
property on it to see whether it was GET or POST:
jQuery(element).ajaxComplete(function(event, request, settings) {
alert(settings.type);
});
您可以用这种方式获取的设置是一样的,你可以用设置 $就
构造。
这篇关于如果检测HTTP方法(POST,GET)的jQuery.ajaxComplete()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文