Home >Backend Development >PHP Tutorial >How PHP interacts with js data

How PHP interacts with js data

零到壹度
零到壹度Original
2018-04-13 17:33:028054browse

The content of this article is to share with you how PHP interacts with js data. It has a certain reference value. Friends in need can refer to it

There are two types of PHP and js There are two transmission methods: one is to use URL, and the other is to transmit within an interface.

The method of transferring under the same interface is as follows:

<html>
<title></title>
<body>
<?php
	$a=1;
	echo "<script>var b=\"$a\"</script>";
?>

<script language="javascript">
	alert(b);
</script>
</body>
</html>

The effect is as follows:


Related recommendations:

Data interaction between PHP and JS

php passes data to javascript

Simple js and php interaction

The above is the detailed content of How PHP interacts with js data. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn