如何将变量从php页面传递到javascript并显示数据 [英] how to pass variables from php page to javascript and display the the data
本文介绍了如何将变量从php页面传递到javascript并显示数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将存储在变量中的数据从php传递到javascript,并通过使用split函数,我们正在拆分数据并将其显示在网络时代....
how to pass the data which is stored in a variable from php to javascript and by using split function we are spliting the data and display it on the web age ....
推荐答案
冒着无语接听被大喊大叫的危险,今天我心情很宽裕:)
At the risk of being shouted at for answering without context, I'm in a generous mood today :)
<?php
//do lots of stuff in my PHP page
$var = 'somevalue';
?>
<html>
<head>
<title>My page title</title>
<script type='text/javascript'>
var myJsVar = '<?php echo $var;?>'
</script>
</head>
<body>
</body>
</html>
这篇关于如何将变量从php页面传递到javascript并显示数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文