Oh i see. Thank you woomla.
It's because i usually use the send() method, that works with the 'data'
key. With post() theres not need for it.
Thanks.

http://mootools.net/shell/xzhuX/2/

--
Fábio Miranda Costa
Solucione Sistemas
Engenheiro de interfaces


On Wed, Jan 27, 2010 at 6:58 AM, woomla <[email protected]> wrote:

> > 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.
>

Reply via email to