1<?php
2 FONCTION_PHP(){
3 ?>
4 <script>
5 function fonctionJavaScript(){
6 }
7 </script>
8<?php
9 }
10 ?>
1//this is my code
2
3you can add javascript to your code by using the echo statement and rap all
4your javascript between "" and if there is "" in the javascript code
5then add \ before any "", and for the php inside rap it with ''
6
7
8<?php
9 echo "<script>document.write(\"hello world\")</script>"
10?>
11
12//other example
13
14<?php
15 $a = 5;
16 echo "<script>document.write('$a')</script>"
17?>
18
19//other example
20
21<?php
22$TokenData = Auth::user();
23
24echo "<script type=\"text/javascript\">
25 localStorage.setItem(\"id\", '$TokenData->id');
26 localStorage.setItem(\"name\", '$TokenData->name');
27 localStorage.setItem(\"email\", '$TokenData->email');
28 </script> ";
29