Hi,
i need to buld an application that goes to a PHP (over ajax) and gets currency quotes every 1 seccond.
(I have set the PHP code and its working fine).
if you take a look at the table in the next page:
http://www.forex-markets.com/quotes_exotic.htm (just an example)
i need to refresh the quotes every 1 second.
what is the best way to do that?

after 90 requests the the browder crashed.
i always makes sure to delete the object.
and im always waiting for status 200 to send the new request so i wont create an over head.

any ideas how todo that?
thanks.

Recommended Answers

All 2 Replies

Use a loop with a timer delay. I would lengthen the amount between polls as 1 sec is a little ambitious for response time.
while(true)
{
//delay for 1 sec
//update quote
}

use setTimeout("function_name();", time(in milisec)); forx example you have a function which fires ajax request every 1 sec. So use it this way:

function funAjax() {
     //Code to send the ajax request

    setTimeout("funAjax();", 1000);
}

After every 1 sec function funAjax will be called.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.