I can think of a half a dozen solutions for sending data from
javascript back to the server, below are three.
1) Have javscript set a cookie:
<script>
var clienttime = ... // long caluculation
setCookie('ct',clienttime,365);
</script>
2) Have javascript send the data as a get variable (you could also
auto submit a form if you want POST)
<script>
var clienttime = ... // long caluculation
window.location = "myscript.php?ct=" + clienttime;
</script>
3) Ajax assuming jQuery
<script>
var clienttime = ... // long caluculation
$.get('myscript.php',{ct:clienttime},function (data) {
alert("script said: " + data);
});
</script>
The cookie method will make the data available to the Server on the
next page view.
The second method will auto redirect and be really sloppy, but it is
the easiest to understand conceptually.
The Ajax method is the best, but will be a real pain in the ass to
implement without a javascript library.
Even though the second method is the worst from a UI perspective, I'd
recommend you implement it first so you better understand the problem.
-John Campbell
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php