为什么我不能使用jQuery中的php计算出的数字?在Javascript中使用PHP变量/ jQuery
我已经试过这样:
<div id="time">
<? echo until();?>
</div>
var until = $("#time").html();
而且
var until = <? echo until();?>;
但是,没有一个工作d:
编辑: 计算出的数量将是472541,而功能:
<?
/**
* @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);
}
}
>
编辑编辑: 不知道是什么只是happend,但似乎现在的工作:O:d 非常感谢,大家:d
请以得到(doog)帮助更新你的答案?等等? – Veger
你可以发布,直到方法和生成的HTML? – Joe
您是否尝试过查看生成的源代码? – Chronial