如果检测HTTP方法(POST,GET)的jQuery.ajaxComplete()方法、POST、HTTP、ajaxComplete

由网友(柠萌i)分享简介:在 jQuery.ajaxComplete()如何检测HTTP方法,特别是一个GET或POST的? In a jQuery.ajaxComplete() how can I detect the HTTP method, specifically a GET or a POST? 我试着读了jQuery文档和​​摸...

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);
});

您可以用这种方式获取的设置是一样的,你可以用设置 $就构造。

阅读全文

相关推荐

最新文章