How PHP interacts with js data

零到壹度
Release: 2023-03-23 18:58:01
Original
8031 people have browsed it

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>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template