How do I override the jQuery.ajaxTransport function?
I need to change the function jQuery.ajaxTransport to make it function correctly with BlackBerry OS5. I have the code worked out, but I want a cl开发者_开发问答ever way to override the function without changing the JQuery framework
THanks,
I believe the concept you are desiring to employ is called Monkey Patching.
Include the jQuery file, then immediately (before using jQuery) include your script which does this:
( function( global )
{
if( global.jQuery )
{
global.jQuery.ajaxTransport = function( transports )
{
//Your new code here
};
}
}( window ) );
You might want to try setting your own ajax transport handler instead, take a look at the documentation for doing so here if you haven't: http://api.jquery.com/jQuery.ajaxTransport/
精彩评论