link js file in php
PHP is completely irrelevant for what you are doing. The generated HTML is what counts.
In your case, you are missing the src attribute. Use
<script type="text/javascript" src="file.js"></script>
link js file in php
PHP is completely irrelevant for what you are doing. The generated HTML is what counts.
In your case, you are missing the src attribute. Use
<script type="text/javascript" src="file.js"></script>
how to add javascript to a php file
//this is my code
you can add javascript to your code by using the echo statement and rap all
your javascript between "" and if there is "" in the javascript code
then add before any "", and for the php inside rap it with ''
<?php
echo "<script>document.write("hello world")</script>"
?>
//other example
<?php
$a = 5;
echo "<script>document.write('$a')</script>"
?>
//other example
<?php
$TokenData = Auth::user();
echo "<script type="text/javascript">
localStorage.setItem("id", '$TokenData->id');
localStorage.setItem("name", '$TokenData->name');
localStorage.setItem("email", '$TokenData->email');
</script> ";
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us