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

Re: A URL API

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 21 Sep 2010 09:53:32 -0700
Message-ID: <AANLkTimR9k1tEoQ9eC0KJnNL4ges+0vZ7OwGbxUkarz-@mail.gmail.com>
To: Adam Barth <w3c@adambarth.com>
Cc: 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>
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 16:54:25 GMT

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