0

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?

1
  • what do you see if you go to 'content/test.php' in your browser? Commented Mar 9, 2015 at 13:52

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

YES! I got this message: Fatal error: Class 'DB' not found in /usr/www/users/pages/content/test.php on line 5
There you go, you are not loading the DB class, if you load it you should get everything working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.