This is script

var time=1;

function timeHere() {
  time = time + 1;
  finalTime = time / 10;


function sayTime() {
  finalTime = time / 10;

<body onload='window.setInterval("timeHere()", 100)' onunload="sayTime()">


I want to get the time i.e. value of finalTime in ajax varable.

Not using cookie, becoz it gives value on same page but after reloading page am using this to javaScript to php

How i get this without reloading or refreshing page...
so question is How to save value of variable in javaScript to ajax variable??

means save value of finalTime in ajax variable
How to do this??

There is no such thing as AJAX variable. In case if you want to persist a Javascript variables' value to a persistent store by making an async request to the server, you can just append the value in consideration to the query string like:


which would be read at the server (using a server side environment of your choice) and then persisted.