I am trying to put this into ajax so everytime a person clicks a button in jquery, it creates a php session. Is it possible just using this?
var milisec=00;
var seconds=60;
function display(){
if (milisec<=0){
milisec=9
seconds-=1
}
if (seconds<=-1){
milisec=0
seconds+=1
}
else {
milisec-=1
document.getElementById('counter').innerHTML= seconds+":"+"0"+milisec+"s";
setTimeout(display,100)
}
if (seconds < 10) {
document.getElementById('counter').innerHTML= "0"+seconds+":"+"0"+milisec+"s";
}
}
display()
I need to post the time it took for them to get to the next page using Php sessions, using ajax.
myphpfile.php
this code should do what you want but I did not test it.
function $.post() from jQuery library will pass your data to php script and also can retrieve some data which you can display on your site or something.
btw, one second has 1000 miliseconds, not 100