On 3/9/06, Gustavo Rahal <[EMAIL PROTECTED]> wrote:
> I believe that the only "high level" data structure is the array.

There are also the object/dict (they're mostly the same thing).

> Using the mochikit interpreter I noticed that "results" is a [object
> XMLHttpRequest]
> but I'm still confused

There are two main problems with the code posted.

First, you probably want to use loadJSONDoc() rather than
doSimpleXMLHttpRequest(). The latter returns the actual request
object, which has the request result as a parameter while the former
will return the data structure you're passing via JSON. You may be
confused about the signatures not matching what you're doing. Think of
JS as having an automatic *arguments parameter on every function and
loadJSONDoc passes them all to doSimple.

For the callback function, for..in doesn't work like python in all
circumstances and that will probably bite you at some point. Either
use for(var i=0; i < x.length;i++) or one of the mochikit iterators
like forEach. A minor point, but you can save yourself some typing by
replacing document.getElementById() with the $() or (less likely to
conflict with another toolkit) getElement().

If you're on firefox, you may be interested in Jesse Rudderman's web
development bookmarklets [1] (in particular, I find his shell to be
much more usable than the Mochi one) and Joe Hewitt's FireBug
extension[2].

You may also want to glance through Crockford's intro to the language
[3] and possibly Simon Willison's overview [4] (which I haven't seen
yet, so I make no promises).

[1] http://www.squarefree.com/bookmarklets/webdevel.html
[2] 
https://addons.mozilla.org/extensions/moreinfo.php?application=firefox&id=1843
[3] http://www.crockford.com/javascript/survey.html
[4] http://ajaxian.com/archives/a-reintroduction-to-javascript

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to