newbie queston (Javascript or Java applet)

E

E.T. Grey

I am putting together a website, and I want to be able to display a real
time quote monitor (a table that display stock prices etc - and is
constantly updated).

I want to be able to update the table with new data without refreshing
the page and causing unsightly 'flickering'. I want to be able too
update cells directly - with a function like this:

updateCell(int Col, int Row, float value, float change)

I am not sure whether to do this in Java (as an applet), or simply to
use javascript - I think Javascript is the 'lighter' option since
applets tend to have a much heavier footprint - leading to slower
startup times etc.

The second thing I would like to ask is if anyone has an
idea/recommendation on the best way to do this updating - I am thinking
of having the data munged into a csv (or XML) file on the server, and
then letting the client (javascript or applet) poll the server every few
minutes. I am worried though, that I may exceed my ISP bandwidth if I
let a (potentially unlimited) number of clients request data from the
server. However, if I push data fetching/processing etc onto the client
(at the moment, I don't even know if that is possible with Javascript),
then I run the risk of making my code visible to all an sundry.
Furthermore, I may not want to disclose the source of my data - which
will be freely visible in the javascript.

Look forward to some informed suggestions/recommendations.
 
U

UnaCoder

Ahh yes, I've got a good solution for you. I've used simular
technology to facilitate an interactive "chat" window on a web site
before. On your web server setup a cgi (I like PHP myself) that polls
your server for the data. The php script should return very small bit
of html that looks something like this:

<html><script>
parent.updateCell(Col, Row, value, change);
</script></html>

Somewhere in your main page you need to setup an iframe. This iframe
can/should be hidden. You can use java script timers to refresh the
iframe once a second, every 5 seconds, or as often as needed. The
refresh will trigger your php script to run, the php script should
check for updates since the last refresh, and if there are any generate
javascript code to updte the effected rows on the web site.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top