In a jQuery.ajaxComplete()
how can I detect the HTTP method, specifically a GET or a POST?
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) { });
Thanks
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);
});
The settings that you can retrieve in this manner are the same as those that you can set with the $.ajax
constructor.