[kw-pm] AJAX recap

Cees Hek ceeshek at gmail.com
Fri Apr 21 07:43:01 PDT 2006


On 4/21/06, Dave Carr <dc0955 at gates.com> wrote:
> I'm jumping the gun, because I've just started to look at prototype, but
> I was wondering... Do you have a simple example like your google
> suggest, but where all the data is already at the browser in a
> javascript data object? Ajax without the ajax ;)

I don't have my own example of using local data for the autocompleter,
but there is an example with code on the script.aculo.us website:

http://wiki.script.aculo.us/scriptaculous/show/Autocompleter.Local

<p>
<label for="bands_from_the_70s">Your favorite rock  band from the 70's:</label>
<br />
<input id="bands_from_the_70s" autocomplete="off" size="40"
type="text" value="" /></p>
<div class="page_name_auto_complete" id="band_list" style="display:none"></div>

<script type="text/javascript">
new Autocompleter.Local(
  'bands_from_the_70s',
  'band_list',
  ['ABBA', 'AC/DC', 'Aerosmith', 'America', 'Bay City Rollers', 'Black
Sabbath', 'Boston', 'David Bowie', 'Can', 'The Carpenters', 'Chicago',
'The Commodores', 'Crass', 'Deep Purple', 'The Doobie Brothers',
'Eagles', 'Fleetwood Mac', 'Haciendo Punto en Otro Son', 'Heart',
'Iggy Pop and the Stooges', 'Journey', 'Judas Priest', 'KC and the
Sunshine Band', 'Kiss', 'Kraftwerk', 'Led Zeppelin', 'Lindisfarne
(band)', 'Lipps, Inc', 'Lynyrd Skynyrd', 'Pink Floyd', 'Queen',
'Ramones', 'REO Speedwagon', 'Rhythm Heritage', 'Rush', 'Sex Pistols',
'Slade', 'Steely Dan', 'Stillwater', 'Styx', 'Supertramp', 'Sweet',
'Three Dog Night', 'The Village People', 'Wings (fronted by former
Beatle Paul McCartney)', 'Yes'],
  {}
);
</script>

Although I haven't tried it, you should be able to paste that into an
HTML page, load the prototype.js and scriptaculous.js libraries in the
page, and it should work.  And generally you would just populate that
list dynamically on the server

Cheers,

Cees


More information about the kw-pm mailing list