How does php value to js?

I introduced menu.js "

on the web site.
<script type="text/javascript" src="js/menu.js"></script>
$abc = "123";

<script type="text/javascript" src="js/menu.js"></script>

but suppose I have a value on the web site that I want to send to menu.js
how should I write php, js before menu.js gets the value of $ABC?

menu.js noodles:

var url = "";
var get = "";

I want to give $abc to url
I want to write directly on html
, but it"s not easy to manage


url is used as a global variable on the php page and assigned via PHP

<script type="text/javascript">
var url = <?php echo $abc ?>;
</script>
<script type='text/javascript' src="js/menu.js"></script>

<script type='text/javascript'>
var a = <%echo $url%>;
</script>
<script type='text/javascript' src="js/menu.js"></script>

menu.js

console.log(a);

when you send a request from menu.js, something in the php file echo is the return value, for example, if you use jquery,success (data) {} data is the value you want. If you access the php file directly, the echo stuff is directly on the page.


ajax request replacement

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be82d3-30c34.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be82d3-30c34.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?