ciao a tutti ,
vorrei un aiuto,
si puo aggiornare il contenuto dentro un div tot secondi senza aggiornare tutta la pagina?
ciao
ciao a tutti ,
vorrei un aiuto,
si puo aggiornare il contenuto dentro un div tot secondi senza aggiornare tutta la pagina?
ciao
new Ajax.PeriodicalUpdater('items', '/items', { method: 'get', frequency: 3, decay: 2 });
come funziona?
ti scarichi Prototypejs, lo includi nell'head, crei un file .PHP, o quello che vuoi, con il contenuto del DIV che vuoi che si aggiorni.
poi fai:
<script type="text/javascript">
Event.Observe(window, "load", function(){
new Ajax.PeriodicalUpdater('IdDiv', 'file.php', { method: 'get', frequency: 3, decay: 2 });
})
</script>
Dove IdDiv è l'id del div da aggiornare e file.php è il file con il contenuto del div.
ah, Google...
http://www.prototypejs.org/
ho scaricato il file lo messo nella cartella script
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento senza titolo</title>
<script type="text/javascript" language="javascript" src="script/prototype-1.6.0.3.js" ></script>
<script type="text/javascript">
Event.Observe(window, "load", function(){
new Ajax.PeriodicalUpdater('ciao', 'prova.asp', { method: 'get', frequency: 3, decay: 2 });
})
</script>
</head>
<body>
<table width="200" border="0" id="ciao">
<tr>
<td><%Response.Write Now()%></td>
</tr>
</table>
</body>
</html>
come mai non si aggiorna?
piu che altro non hai nessun div nella tua pagina.
intanto prova a cambiare
aCodice PHP:
<td><%Response.Write Now()%></td>
Codice PHP:
<td><div id="ciao"><%Response.Write Now()%></div></td>
ho provato , non va , come devo fare?
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento senza titolo</title>
<script type="text/javascript" language="javascript" src="script/prototype-1.6.0.3.js" ></script>
<script type="text/javascript">
Event.Observe(window, "load", function(){
new Ajax.PeriodicalUpdater('ciao', 'prova.asp', { method: 'get', frequency: 3, decay: 2 });
})
</script>
</head>
<body>
<div align="center" id="ciao"><%Response.Write Now()%></div>
</body>
</html>