Как да направя страницата да се рефрешва...

ih999

Registered
Здравейте,как да направя страницата да се рефрешва,но не цялата а дадена част както http://kefche.com/ там със масовите?Направихме ги ,но не можем да направим да се рефрешва страницата..Който ми помогне +1.
 
HTML:
<meta http-equiv="refresh" content="5" />
или
HTML:
<meta http-equiv="refresh" content="5;url=http://www.yoursite.com/newpage.htm" />

5 са ти секундите. :)
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title>Ajax Refresh</title>

<!-- ТУК ТРЯБВА ДА ЗАРЕДИШ jQuery --!>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>

<script type="text/javascript">

function reload(param){
return $.ajax({
type: "POST",
url:"reload_data.php",
data: "param=" + param,
async: false,
error: function(msg){alert( "AJAX Error: " + msg );}
}).responseText;
}


function start() {

//Ако искаш да пратиш параметри към заявката, може да го направиш тук. Може да сложиш много параметри.
$('#content').html(reload('Params...'));

t=setTimeout('start()',1000); //Време на презареждане в милисекунди

}

</script>

</head>

<body>
<center>
<div style="padding:20px; margin:50px; font-size:20px; border:2px solid red;" id="content"></div>
<div style="padding:20px; margin:50px; font-size:20px; border:2px solid green;"><?= time() ?></div>
</center>

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.


<script type="text/javascript">
start();
</script>

</body>
</html>



Другият файл: reload_data.php


<?php

echo "Param :" . $_POST['param'] . ", Time = " . time();

?>

Демо:

http://web.geobg.info/?demo=refresh
 

Back
Горе