什麼是最好的方式來回顯變量get_parestotal?echo a javascript變量
請幫忙! 謝謝
<script type="text/javascript">
$(document).ready(function(){
var get_parestotal = 0
$(".parestotal").each(function(){
get_parestotal += parseFloat($(this).text());
});
alert(get_parestotal);
});
</script>
<? echo json_encode($get_parestotal); ?>
你不能這樣做。但你可以alert或console.log(get_parestotal) – andrex 2014-09-22 12:43:00
echo是在PHP服務器端,而變量是在客戶端... – fast 2014-09-22 12:43:19
對。 你可以鏈接我一些使用console.log的例子嗎? 謝謝 – gatuso 2014-09-22 12:44:17