I think I might have the same problem and my plan was to use
queryString function found on
http://www.mochikit.com/doc/html/MochiKit/Base.html#fn-querystring in
combination with the static url constructed by tg.url. This is the
best version I could come up with:
d = loadJSONDoc(${tg.url('/arealist',
tg_format='json')}+'&'+queryString({'city':$('address_city')}));
You don't have to encode each javascript variable if there are more
than one yet you still have the flexibility of tg.url for python
variables. If there is a better way someone please speak up.
-Ian
On 7/20/06, Olli Wang <[EMAIL PROTECTED]> wrote:
>
> hi, i want to render an address like "/arealist?tg_format=json&city=1"
> in JS.
>
> here's my original code:
> d = loadJSONDoc('/arealist?tg_format=json&city='+$('address_city'));
>
> but this way will get a not well-formed traceback, so i must use
> tg.url.
> my problem is how to combine JS variable with ${tg.url()} like:
>
> d = loadJSONDoc(${tg.url('/arealist', tg_format='json',
> 'city'=$('address_city'))})
>
> of course this doesn't work. any ideas? thanks
>
>
> PS. $(id) is provided by MochiKit.
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---