JavaScript files need not have the .js extension. Sometimes you need to generate JavaScript dynamically and you end up with a .php file. For example, for placing markers in a Google map with the API, I generated the JavaScript file with php (fetching the marker locations from a database) rather than using some sort of AJAX. There's nothing wrong with it.
why is thenextweb team page including an external php file with <script> tag
-
04-06-2022 - |
Question
I was looking at thenextweb's team page and found that inside < head>, they are including an external php file within the < script> tag. Is this a good practice ? And what might be the purpose of doing this ?
URL: http://thenextweb.com/about/team/
Code:
<script type="text/javascript" src="/about/php/scriptsData.php"></script>
La solution
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow