> its .post({data: {'method': 'store', 'params': 'bla bla'}})
No, it's not / yes it is ;-)
This line in mootools 1.2.4:
var params = Array.link(arguments, {url: String.type, data:
$defined});
creates an array with two possible indexes: url and data.
In this example
jsonRequest.post({ 'method': 'store', 'params': 'bla bla'});
params will be [data] = { 'method': 'store', 'params': 'bla bla'},
In this example
.post({data: {'method': 'store', 'params': 'bla bla'}})
params will be [data] = {data: {'method': 'store', 'params': 'bla
bla'}}
So which post you'll need depends on how your server expects the post
data.
See the difference at: http://mootools.net/shell/xzhuX/1/
On 26 jan, 22:54, Fábio M. Costa <[email protected]> wrote:
> its .post({data: {'method': 'store', 'params': 'bla bla'}})
> --
> Fábio Miranda Costa
> Solucione Sistemas
> Engenheiro de interfaces
>
> On Tue, Jan 26, 2010 at 7:13 PM, woomla <[email protected]> wrote:
> > Straight from the examples on mooshell.net, little bit changed to
> > reflect your example:http://mootools.net/shell/xzhuX/
>
> > > var jsonRequest = new Request.JSON({url: serviceURL, onSuccess:
> > > function(result){
> > > alert("result:"+result);}}).post({'method': 'store', 'params': 'bla
> > bla'});
>
> > Be adviced, although you set the parameter 'method' to the value
> > 'store' in the call to post, you'll execute the method post. The
> > parameter 'method' with value 'store' is simply send to the server as
> > post data. See the example
>
> > Wo.