0
我正在尝试在同一页.php
页面上共享数据。我通过POST方法在页面上收到一些数据,并且我希望在页面加载期间在该页面上的JavaScript上使用它。但不知何故,javascript显示的值为undefined
。什么原因,我该如何解决?在同一页上共享php和javascript之间的数据
<?php
echo "<label id='origin' style='visibility:hidden;'>".$_POST["startStation"]."</label>";
?>
<script type="text/javascript">
alert(document.getElementById('origin').value);
</script>