I would like to include the abosolute path of each load because I have rewritten the url and want to esnure that populateResults.php
loads
$(document).ready(function() {
$("#results").load("functions/populateResults.php"); //initial page number to load
$(".pagination").bootpag({
total: <?php echo $pages; ?>,
page: 1,
maxVisible: 5
}).on("page", function(e, num){
e.preventDefault();
window.scrollTo(0, 0);
$("#results").prepend('<div class="loading-indication"><img src="/content/ajax-loader.gif" /> Please wait... Loading New Courses...</div>');
$("#results").load("functions/populateResults.php", {'page':num});
});
});
</script>
I am not sure and don't think doing /functions/populateResult would work.
Update
<?php $root_url = $_SERVER['HTTP_HOST']; ?>
<script>
var root_url = '<?= $root_url ?>';
$(document).ready(function() {
$("#results").load(root_url + "/functions/populateResults.php"); //initial page number to load
$(".pagination").bootpag({
total: <?php echo $pages; ?>,
page: 1,
maxVisible: 5
}).on("page", function(e, num){
e.preventDefault();
window.scrollTo(0, 0);
$("#results").prepend('<div class="loading-indication"><img src="/content/ajax-loader.gif" /> Please wait... Loading New Courses...</div>');
$("#results").load(root_url + "/functions/populateResults.php", {'page':num});
});
});
</script>
This is what I would do: Use PHP to get your root url, set that to a variable and send it to JS to use it where you wish.
<?php
$base_url = $_SERVER['HTTP_HOST'];
?>
<script>
var base_url = '<?= $base_url ?>';
$(document).ready(function () {
$("#results").load(base_url + "/functions/populateResults.php");
//.. your other code..
});
</script>