Simple Timer Demo with JavaScript


I visited an auctioneer website at my brothers request that was working on what seem to be some time of bot auction.  There was this box that was logging messages live and anyone could bid on the item being auction.  This was just like a real live auction, except it was done over the web…

A typical log would like like this

  • Auctioneer:  Now bidding for 7.50
  • Auctioneer: This bid is about to close
  • Auctioneer: This bid is about to close
  • Auctioneer: Now the bidding for 8.00
  • Auctioneer: This bid is about to close
  • Auctioneer: This bid is about to close
  • Auctioneer: Item sold to bidder #349 for 8.00

That got me thinking about timers in javascript.  Timers, I assume is something that I have to understand in order to continue refreshing the page with everyone’s bids.  It could also be done with async call backs possibly but for my experiment I wanted to try out timers.  I know I also have to understand AJAX and connect it to a back end for fetching.  So I decided to create a demo.  It is a simple demo but just little things were kicking my butt like having bugs with undeclared variables and such. 

Anyway I got the whole thing working and posted to my webexperiment (followmetotheweb page.

You can check it out here


You can view the code as by selecting view source.

It is pretty much a beginner's exercise but since I went through all the trouble I figured I'd share it.

Comments

Popular posts from this blog

Simple Example of Using Pipes with C#

Difference Between Adapter and Bridge Design Patterns

Remote Access to Your Home Desktop Using No-IP