How to pass 1 parameter using Ajax.PeriodicalUpdater
//From the main.php file
var pars = 'test time';
new Ajax.PeriodicalUpdater('clock', 'clock.php', { method: 'get', frequency: 1, parameters: pars });
//Inside开发者_JAVA技巧 the tiny clock.php file I cannot read the passed value.
php
echo "@Init time : ".$_GET["inittime"];
This is just about passing values to the file displayed in the 'clock' placeholder.
I will need to pass others. Thanks in advance!
you need to use the variable sendData
instead of parameters
according to the perdiodical updater documentation
sendData Array of values to be passed to the page – e.g. {name: “John”, greeting: “hello”}
Thanks "A" thats jQuery, i'm using Ajax.PeriodicalUpdater with prototype.js
I did it like this in the end!
var clientClickTime=((new Date()).getTime())/1000;
var url="clock.php?clientClickTime="+clientClickTime;
new Ajax.PeriodicalUpdater('clock', url, { method: 'get', frequency: 1 });
Power to ya!
精彩评论