how to automatically refresh a dynamic web page after 1 second at once(not continually) using javascript ?

Do you want to do that once, or every second? setTimeout() can trigger a function. Then you can get the new page with ajax and replace it. When that's done, you can remove the function from the timeout function.

Here is a code to refresh a page each second:

<html>
<head>
<script type="text/JavaScript">
<!--
function timedRefresh(timeoutPeriod) {
    setTimeout("location.reload(true);",timeoutPeriod);
}
//   -->
</script>
</head>
<body onload="JavaScript:timedRefresh(1000);">
</body>
</html>

Sanchixx

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.