1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
Index: /Users/jan/webdev/moodev/mootools/trunk/Remote/Json.js
===================================================================
@@ -30,9 +30,11 @@
*/
encode: function(obj){
+ if(obj.toJSON) return obj.toJSON();
switch ($type(obj)){
case 'string':
return '"' + obj.replace(/[\x00-\x1f\\"]/g, Json.$replaceChars) + '"';
+ case 'arguments': obj = $A(obj);
case 'array':
return '[' + obj.map(Json.encode).filter($defined).join(',') + ']';
case 'object':
Index: /Users/jan/webdev/moodev/mootools/trunk/Remote/XHR.js
===================================================================
@@ -63,7 +63,7 @@
this.setTransport();
this.setOptions(params.options);
this.options.isSuccess = this.options.isSuccess || this.isSuccess;
- this.headers = $merge(this.options.headers);
+ this.headers = $merge({'X-Requested-With': 'XMLHttpRequest'}, this.options.headers);
if (this.options.urlEncoded && this.options.method != 'get'){
var encoding = (this.options.encoding) ? '; charset=' + this.options.encoding : '';
this.setHeader('Content-type', 'application/x-www-form-urlencoded' + encoding);
Index: /Users/jan/webdev/moodev/mootools/trunk/Remote/Ajax.js
===================================================================
@@ -46,7 +46,6 @@
this._method = '_method=' + this.options.method;
this.options.method = 'post';
}
- this.setHeader('X-Requested-With', 'XMLHttpRequest');
this.setHeader('Accept', 'text/javascript, text/html, application/xml, text/xml, */*');
},
Index: /Users/jan/webdev/moodev/mootools/trunk/Remote/Json.Remote.js
===================================================================
@@ -32,6 +32,7 @@
this.parent(url, options);
this.addEvent('onSuccess', this.onComplete, true);
this.setHeader('X-Request', 'JSON');
+ this.setHeader('Accept', 'text/javascript');
},
send: function(obj){
|