I have page.php with about 10 JS files:
PAGE.PHP
<script type="text/javascript" src="somefile1.js"></script>
<script type="text/javascript" src="somefile2.js"></script>
<script type="text/javascript" src="somefile3.js"></script>
...
<div id="pictures"></div>
...
in this page I have some pictures, that need all this js, and a AJAX function to do an pagination after each 10 pictures:
AJAX
next page ->
$.post('/LOADMORE.php',{
'group_no': track_load,
'idpag': idpag
},
Ok, when user click in next page the AJAX will call LOADMORE.PHP to load more pictures in div id="pictures"
this pictures need some Jquery (as the pictures above - this jquery functions is in PAGE.PHP already) functions to open pictures bigger in the screen and other things.
What happening is that the scripts in PAGE.PHP does not work with the pictures loaded using AJAX pagination. So I need to include all 10 js files in LOADMORE.PHP too:
<script type="text/javascript" src="somefile1.js"></script>
<script type="text/javascript" src="somefile2.js"></script>
<script type="text/javascript" src="somefile3.js"></script>
<?php
$stmt = $mysqli->prepare("SELECT * FROM posts ORDER BY id DESC LIMIT ?");
...
while($l = $result->fetch_assoc()) {
echo"<img src=$picture>";
}
?>
My question 1 is, is it right, do I need to include JS in loadmore.php for this to work?
Question 2: if it is right, there is no problem that this
<script>
in loadmore.php is not on the<head>
tag? because the loadmore.php is just a PHP function that select pictures in mysql and bring it to the user, there is no<head><title><body>...
should I use this tags?