This tiny plugin provides a registry for different xhr implementations to co-exist.It requires jQuery 1.3/1.2.7 with its new feature, the 'xhr' ajax setting.

If you want to provide a new implementation, you need to do this:

  1. jQuery.xhr.register( 'my_xhr'function( settings ){ 
  2.     return new MyXhrImplementation( settings ); 
  3. });  

The argument settings is the settings object used by jQuery.ajax.To use it, you do:

  1. $.ajax({ 
  2.     url:'...'
  3.     transport:'my_xhr'
  4.     // ... 
  5. }); 

The default implementation is used by default (unless it's overriden with ajaxSetup) and it's called 'xhr'.


转载请注明:代码家园 » XHR