W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2010

Re: A URL API

From: Ojan Vafai <ojan@chromium.org>
Date: Wed, 22 Sep 2010 08:40:30 +1000
Message-ID: <AANLkTikrzvLfK-nqNcodc=m0z7rFXcb+Tkb9ALJcPROV@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: Adam Barth <w3c@adambarth.com>, Devdatta Akhawe <dev.akhawe@gmail.com>, Darin Fisher <darin@chromium.org>, Garrett Smith <dhtmlkitchen@gmail.com>, Julian Reschke <julian.reschke@gmx.de>, WebApps WG <public-webapps@w3.org>
appendParameter/clearParameter seems fine to me.

On Wed, Sep 22, 2010 at 2:53 AM, Tab Atkins Jr. <jackalmage@gmail.com>wrote:

> On Mon, Sep 20, 2010 at 11:56 PM, Adam Barth <w3c@adambarth.com> wrote:
> > Ok.  I'm sold on having an API for constructing query parameters.
> > Thoughts on what it should look like?  Here's what jQuery does:
> >
> > http://api.jquery.com/jQuery.get/
> >
> > Essentially, you supply a JSON object containing the parameters.  They
> > also have some magical syntax for specifying multiple instances of the
> > same parameter name.  I like the easy of supplying a JSON object, but
> > I'm not in love with the magical syntax.  An alternative is to use two
> > APIs, like we current have for reading the parameter values.
>
> jQuery's syntax isn't magical - the example they give using the query
> param name of 'choices[]' is doing that because PHP requires a [] at
> the end of the query param name to signal it that you want multiple
> values.  It's opaque, though - you could just as easily have left off
> the '[]' and it would have worked the same.
>
> The switch is just whether you pass an array or a string (maybe they
> support numbers too?).
>
> I recommend the method be called append*, so you can use it both for
> first sets and later additions (this is particularly useful if you're
> just looping through some data).  This obviously would then need a
> clear functionality as well.
>
> ~TJ
>
>
Received on Tuesday, 21 September 2010 22:41:21 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:40 GMT