Why can't I use a calculated number, from php in jQuery?
I've tried this:
<div id="time">
<? echo until();?>
</div>
var until = $("#time").html();
And
var until = <? echo until();?>;
But no one works D:
EDIT: The calculated number will be 472541, and the function:
<?
/**
* @desc Time until tuesday
* @param string Time format
* @return string timestamp
*/
function until($format = ""){
$now = strtotime("now");
$nextTuesday = strtotime("-1 hour next tuesday");
$until = $nextTuesday - $now;
if(empty($format)){
return $until;
}else{
return date("$format",$until);
}
}
?>
EDIT EDIT: Don't know what just happend, but it seems to work now :O :D Thanks a lot, everyone :D