Hi Alex,

Enumerable#each will loop through the array, or of course just a
boring old-fashioned for loop is fine. For splitting the strings into
individual characters, you can use String#split with "" as the
separator, that gives you back an array of one-character strings
(which you could use Enumerable#each on, or just a for loop).  For
appending them to the page, you'd either just append the characters to
innerHTML (directly or via update) or append spans, whichever performs
more smoothly in your tests.

T.J. Crowder
tj / crowder software / com

On Sep 24, 10:26 am, Alex Mcauley <webmas...@thecarmarketplace.com>
> Good morning people.
> I am trying to develop a typewriter module for a website that takes
> the text from a json array returned by an ajax request. Can prototype
> handle looping the array that is returned and deal with outputting it
> to the browser one character at a time?
> The retrurned array from the server will be something along the lines
> of
> { "items": [
>    { "title: "My first title", "content" : "My first piece of
> content"},
>    { "title": "My second title", "content": "My second piece of
> content"},
>    { "title": "My thrid title", "content": "My third piece of
> content"}
> ]
> }
> Basicaly i would like to itterate each part of that array and do
> something with it.
> Does anyone know a good reading source or could nudge me in the right
> direction of what i should be doing?
> Thanks in advance
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to