开发者

Webpage AutoRefresh

1) I want to make a live score mobile app in which the updates for the app is retrieved from my website....which is stored in the form of text file 2) On the server I want 开发者_运维知识库to write a scripting file which will do the work of retrieving the live score from some RSS feed & convert it into the text file format I need for the app

Now the Q is I want to make this scripting file to be invoked after every 1 minute to update the live score....either server should invoke this file or is there any mechanism in which the file will invoke itself

Thanks


Have a look at the javascript setInterval method. It allows you to invoke a javascript method on a timed interval. You could use that javascript method + ajax to call back to the server. Without knowing your back end technology, one can't get into specifics about what to do on the server, however.


You could use this lovely little HTML snippet if you just want the page to refresh every x amount of seconds

<META HTTP-EQUIV=Refresh CONTENT='60; URL=index.php' /> 


Serve the scores up in JSON format and simply use jQuery.getJSON to grab the data in the client.

http://api.jquery.com/jQuery.getJSON/

See these answers for examples:

Reload AJAX data every X minutes/seconds, jQuery

Ajax success, how to refresh response every minute


expanding a wee bit on Hacknightly's answer:

..with a bit more clarity for general consumption:

<head>
    <meta http-equiv="refresh" content="30">
</head>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜