Quote viewer in AJAX…

I switched the implementation of my quote viewer from Flash to Javascript last night for fun and education. If you view source, it’s there for you to find in gory detail, but here it goes for the lazy…

In the header of this page you will find tag that loads the script that enables the quote viewer:

<script language="javascript" type="text/javascript" src="/widgets/quoteview/quoteview.js"></script>

At the top of the script you will notice two variables, one sets the number of seconds I want this quote to auto-refresh (set to -1 to disable) and the the next indicates where to find the XML document that contains the quotes I want to display.

Methods in the script will load a random quote and refresh a div element on the page:

<div id="quoteview"></div>

To kick it off, I call a method from the script:

<script language="javascript" type="text/javascript" src="/widgets/quoteview/quoteview.js">quoteViewXmlRequest();</script>

And that’s it 🙂 I’m a server-side developer by trade so if you care to take a look at this and critique, it could be helpful.

One thought on “Quote viewer in AJAX…

  1. Without your source (xml doc) and js, I couldn’t say saddly. What url?

Comments are closed.