Thanks TJ. Do you have an example on the loop ..
Does it go somehing like items.each(function(item) { alert(item.title+ ' ' +item.content); }); ? Alex Mcauley http://www.thevacancymarket.com ----- Original Message ----- From: "T.J. Crowder" <t...@crowdersoftware.com> To: "Prototype & script.aculo.us" <prototype-scriptaculous@googlegroups.com> Sent: Thursday, September 24, 2009 11:17 AM Subject: [Proto-Scripty] Re: Json and prototype 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. FWIW, -- T.J. Crowder tj / crowder software / com www.crowdersoftware.com On Sep 24, 10:26 am, Alex Mcauley <webmas...@thecarmarketplace.com> wrote: > 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 prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---