Hi, Johnny,
Thanks for your answer. I found out a similar approach during the night :)
Now I am bugging with autocompletion (when your select list is too
big... more than 200 000 elements).
Cheers
Alberto
On 5/20/07, Johnny Blonde <[EMAIL PROTECTED]> wrote:
>
> hello alberto,
>
> the deferred story was bugging me in the beginning, too, but when you
> got it you´ll love them!
>
> most simple thing to do:
>
>
> d = loadJSONDoc("aurl.php?"+queryString({'a':'b', 'c':'d'})) // calls
> aurl.php?a=b&c=d
> d.addCallbacks(
> function(data) {
> // let´s assume, the server sent sends a list like this to fill
> the selectbox
> // [[1, 'one'], [2, 'two'], [3, 'three']]
> // this is assigned to data and already javascriptified
> replaceChildNodes("yourSelectFieldId")
> for(item in data) {
> appendChildNodes("yourSelectFieldId", OPTION({'value': data[item]
> [0]}, data[item][1]))
> }
> },
> function(error) {
> // do_some_error_handling(error)
> alert(error)
> }
> )
>
>
> your selectbox will then contain the values from the json-return, that
> is sent by the server.
>
> HTH,
> Frank
>
>
> >
>
--
Alberto Simões
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" 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/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---