Ignore:
Timestamp:
Dec 18, 2009, 10:12:41 PM (14 years ago)
Author:
rvelices
Message:

merge -r4512 from branch 2.0 to trunk
web method images.setPrivacyLevel (ws_images_setPrivacyLevel) is POST only

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/template-common/scripts.js

    r3282 r4513  
    112112                this.transport.onreadystatechange = this.onStateChange.pwgBind(this);
    113113
    114                 var url = this.urlRoot;
    115                 url += "ws.php?format=json&method="+method;
     114                var url = this.urlRoot+"ws.php?format=json";
     115
     116                var body = "method="+method;
    116117                if (parameters)
    117118                {
     
    121122                                {
    122123                                        for (var i=0; i<parameters[property].length; i++)
    123                                                 url += "&"+property+"[]="+encodeURIComponent(parameters[property][i]);
     124                                                body += "&"+property+"[]="+encodeURIComponent(parameters[property][i]);
    124125                                }
    125126                                else
    126                                         url += "&"+property+"="+encodeURIComponent(parameters[property]);
     127                                        body += "&"+property+"="+encodeURIComponent(parameters[property]);
    127128                        }
    128129                }
    129                 this.transport.open(this.options.method, url, this.options.async);
    130                 this.transport.send(null);
     130
     131                if (this.options.method == "POST" )
     132                {
     133                        this.transport.open(this.options.method, url, this.options.async);
     134                        this.transport.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
     135                        this.transport.send(body);
     136                }
     137                else
     138                {
     139                        url += "&"+body;
     140                        this.transport.open(this.options.method, url, this.options.async);
     141                        this.transport.send(null);
     142                }
    131143        },
    132144
Note: See TracChangeset for help on using the changeset viewer.