On Tuesday, May 10, 2011 4:48:35 PM UTC-4, JagChris wrote: 
>
> on the view where i have them inputting their answers i have place 
> some javascript. but how do i use ajax to pass that value to python

 
You don't necessarily need to use ajax to pass the value. You can create a 
hidden field in your form and use a jQuery .submit() handler to update its 
value with the elapsed time upon submission. Or, as pbreit suggested, you 
could handle the time calculation entirely on the server side -- store the 
initial page request time in the session (or in a hidden form field before 
delivering the form), and then calculate the elapsed time on the server side 
after the form is submitted. The client-side Javascript method will be a 
little more accurate because it won't include the network transit times of 
the two requests, but that will probably be negligible, unless you need very 
precise times.
 
Anthony

Reply via email to