From e1e034ced29b0b9bf11a49798b4fba4d3dd0164d Mon Sep 17 00:00:00 2001 From: wei <> Date: Fri, 21 Apr 2006 11:41:21 +0000 Subject: Update javascript libraries, rewrote client-side validators, removed some js files, simplified javascript compression. --- framework/Web/Javascripts/prototype/ajax.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'framework/Web/Javascripts/prototype/ajax.js') diff --git a/framework/Web/Javascripts/prototype/ajax.js b/framework/Web/Javascripts/prototype/ajax.js index e3d442a4..7ec7716c 100644 --- a/framework/Web/Javascripts/prototype/ajax.js +++ b/framework/Web/Javascripts/prototype/ajax.js @@ -1,9 +1,9 @@ var Ajax = { getTransport: function() { return Try.these( + function() {return new XMLHttpRequest()}, function() {return new ActiveXObject('Msxml2.XMLHTTP')}, - function() {return new ActiveXObject('Microsoft.XMLHTTP')}, - function() {return new XMLHttpRequest()} + function() {return new ActiveXObject('Microsoft.XMLHTTP')} ) || false; }, @@ -55,6 +55,7 @@ Ajax.Base.prototype = { this.options = { method: 'post', asynchronous: true, + contentType: 'application/x-www-form-urlencoded', parameters: '' } Object.extend(this.options, options || {}); @@ -114,11 +115,11 @@ Ajax.Request.prototype = Object.extend(new Ajax.Base(), { setRequestHeaders: function() { var requestHeaders = ['X-Requested-With', 'XMLHttpRequest', - 'X-Prototype-Version', Prototype.Version]; + 'X-Prototype-Version', Prototype.Version, + 'Accept', 'text/javascript, text/html, application/xml, text/xml, */*']; if (this.options.method == 'post') { - requestHeaders.push('Content-type', - 'application/x-www-form-urlencoded'); + requestHeaders.push('Content-type', this.options.contentType); /* Force "Connection: close" for Mozilla browsers to work around * a bug where XMLHttpReqeuest sends an incorrect Content-length @@ -149,7 +150,7 @@ Ajax.Request.prototype = Object.extend(new Ajax.Base(), { evalJSON: function() { try { - return eval(this.header('X-JSON')); + return eval('(' + this.header('X-JSON') + ')'); } catch (e) {} }, -- cgit v1.2.3