summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/prototype/ajax.js
diff options
context:
space:
mode:
authorwei <>2006-04-21 11:41:21 +0000
committerwei <>2006-04-21 11:41:21 +0000
commite1e034ced29b0b9bf11a49798b4fba4d3dd0164d (patch)
tree92120227f58c2463ddb50b1592dde0436d175189 /framework/Web/Javascripts/prototype/ajax.js
parente57fc66ee3f5259b4f7cbd18a1cd0f6da6176f5d (diff)
Update javascript libraries, rewrote client-side validators, removed some js files, simplified javascript compression.
Diffstat (limited to 'framework/Web/Javascripts/prototype/ajax.js')
-rw-r--r--framework/Web/Javascripts/prototype/ajax.js13
1 files changed, 7 insertions, 6 deletions
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) {}
},