Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #4825: ie-5.5-get-post.patch.txt

File ie-5.5-get-post.patch.txt, 1.7 kB (added by nicrizzo@gmail.com, 3 years ago)
Line 
1 Index: src/ajax.js
2 ===================================================================
3 --- src/ajax.js (revisione 4324)
4 +++ src/ajax.js (copia locale)
5 @@ -53,7 +53,7 @@
6  Ajax.Base.prototype = {
7    setOptions: function(options) {
8      this.options = {
9 -      method:       'post',
10 +      method:       'POST',
11        asynchronous: true,
12        contentType:  'application/x-www-form-urlencoded',
13        parameters:   ''
14 @@ -89,12 +89,12 @@
15  
16      try {
17        this.url = url;
18 -      if (this.options.method == 'get' && parameters.length > 0)
19 +      if (this.options.method.toUpperCase() == 'GET' && parameters.length > 0)
20          this.url += (this.url.match(/\?/) ? '&' : '?') + parameters;
21        
22        Ajax.Responders.dispatch('onCreate', this, this.transport);
23        
24 -      this.transport.open(this.options.method, this.url,
25 +      this.transport.open(this.options.method.toUpperCase(), this.url,
26          this.options.asynchronous);
27  
28        if (this.options.asynchronous) {
29 @@ -105,7 +105,7 @@
30        this.setRequestHeaders();
31  
32        var body = this.options.postBody ? this.options.postBody : parameters;
33 -      this.transport.send(this.options.method == 'post' ? body : null);
34 +      this.transport.send(this.options.method.toUpperCase() == 'POST' ? body : null);
35  
36      } catch (e) {
37        this.dispatchException(e);
38 @@ -118,7 +118,7 @@
39         'X-Prototype-Version', Prototype.Version,
40         'Accept', 'text/javascript, text/html, application/xml, text/xml, */*'];
41  
42 -    if (this.options.method == 'post') {
43 +    if (this.options.method.toUpperCase() == 'POST') {
44        requestHeaders.push('Content-type', this.options.contentType);
45  
46        /* Force "Connection: close" for Mozilla browsers to work around