Reputation: 3255
i tried to load div content from a separate page into another page.
PAGE TO LOAD CONTENT INTO:
<script type="text/javascript">
var auto_refresh = setInterval(function() {
$('#incidentsTable').load('content/test.php #table');
}, 1000);
</script>
<div id="incidentsTable">
</div>
Page to load content from
<?php
// Connect to Database
$db = DB::getInstance();
?>
<div id="table">
<table class='table'>
<thead>
<th>Latitude</th>
<th>Longitude</th>
</thead>
</table>
</div>
I got some strange output. Without the php part at the beginning, the content is loaded perfectly fine into the other page. As soon as I include this php code to get the data later on to fill the table (this part of the code is excluded in the code snippet), nothing appears anymore on the screen at this section of the page where I load the content into.
Am I not allowed to use PHP functionality before the DIV tags? Or did I miss something out?
Upvotes: 0
Views: 36
Reputation: 21789
I think you might be getting an error from that first PHP code snippet, try enabling error reporting and kill the execution flow in order to see what you are getting:
<?php
// Connect to Database
ini_set('error_reporting', E_ALL);
ini_set('display_errors', true);
$db = DB::getInstance();
die;
?>
In order to check what you are getting, open the developers console (f12 in chrome), go to the network tab and look for "content/test.php" and click for it, after that check the "Response" tab of that request in order to check the output.
Upvotes: 2