', 'Loaded', 'Interactive', 'Complete'];
/** * */ Ajax.Request.prototype = (new Ajax.Base()).extend({ initialize: function(url, options) { this.transport = Ajax.getTransport(); this.setOptions(options);
try { if (this.options.method == 'get')
url += '?' + this.options.parameters + '&;_=';
/** * 此处好像强制使用了异步方式,而不是依照 this.options.asynchronous 的值 */ this.transport.open(this.options.method, url, true);
/** * 这里提供了 XmlHttp 传输过程中每个步骤的回调函数 */ if (this.options.asynchronous) { this.transport.onreadystatechange = this.onStateChange.bind(this); setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10); }
this.transport.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); this.transport.setRequestHeader('X-Prototype-Version