Try:

new Ajax.Request(url, {
  parameters: { foo: 'hello world' },
  onComplete: function(t) {
    alert(t.request.parameters.foo);
  }
});

Best,

Tobie

On Jan 27, 11:12 pm, "Gareth Evans" <[EMAIL PROTECTED]> wrote:
> Someone correct me if i'm wrong but the parameters/postbody you sent do not
> automatically come back in your response/transport.
>
> What I do, is anything I *need* to come back, eg an element id etc, I pass
> in the querystring instead of the form (append to the URL).
> The reason i do this, (i use asp.net serverside) is then I take the
> request.querystring collection and issue a few replaces on the string
> representation of it, converting it to json.
> (also set header)
>
> replace & with ","
> replace = with ":"
> append a {" on the start
> append a "} on the end
>
> Then, when my transport is received by the client I can use responseJSON to
> access the values I sent originally.
> I use this pattern because the request is asynchronous and it looses
> context.
>
> As an afterthought, bind will work for an anonymous function, you could bind
> it to some custom object with the data you want...
>
> On Jan 27, 2008 11:47 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
>
> > Ok so I have the request object. Sorry for the ignorance but how to I
> > get for example a parameter called "fieldName" I sent.
>
> > request.getParameter("fieldName") ???? Will this work?
>
> > Shy.
>
> > On 27 ינואר, 03:52, Tobie Langel <[EMAIL PROTECTED]> wrote:
> > > Hi,
>
> > > The request and transport objects are available as a property of the
> > > Ajax.Response object (the one passed to your parameters), as described
> > > here:http://prototypejs.org/api/ajax/response
>
> > > Best,
>
> > > Tobie
>
> > > On Jan 26, 9:34 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > > > Hi,
>
> > > > I am using ajax.request(...) and would like in the onSuccess function
> > > > to do some logic based on the parameters I sent in the request (think
> > > > about a field name to be validated and I would like th update it's div
> > > > using name convention).
>
> > > > How can i have acess to it?
>
> > > > In dojo you could add it to the request as an additional option:
>
> > > > FieldName: field.name,
>
> > > > and then get it using:
>
> > > > options.fieldName
>
> > > > Is there anything in prototype?
>
> > > > Cheers,
>
> > > > Shy.-הסתר טקסט מצוטט-
>
> > > -הראה טקסט מצוטט-
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to