Created
August 17, 2012 12:25
-
-
Save cowboy/3378441 to your computer and use it in GitHub Desktop.
jQuery: How can I create a catch-all Ajax transport?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// When I set up a json-specific transport... | |
$.ajaxTransport("json", function(options) { | |
console.log("json", options); | |
}); | |
// The json options are logged. | |
$.getJSON("/foo"); | |
// When I try to set up a catch-all transport... | |
$.ajaxTransport("*", function(options) { | |
console.log("catch-all", options); | |
}); | |
// Nothing is logged. The transport factory function doesn't execute. | |
$.ajax("/foo"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! I must have missed the
+
in the docs.