I'm using a script (applications/view/pages/home.php) which has an AJAX request whereby it gets and displays the content of another script (we'll call it scheduler.php). The scheduler file is just a file containing dynamically modified html based on a $_GET parameter passed to it from the AJAX request.
My issue is that this dynamic content comes from the database, and since the scheduler.php is being called by AJAX, it doesn't inherit the $this->db-> ability.
I get the error: Fatal error: Using $this when not in object context.
How can I fix this? I am a novice to both CodeIgniter and to AJAX. Thanks!
Edit: Scheduler.php code:
<?php
$shift = $_GET['shift'];
?>
<table>
<tr>
<th><?php echo $d->format('l') . '<br>' . $d->format('F jS'); ?></th>
</tr>
<tr>
<td>
<?php
$this->db->select('id', 'event', 'time');
$query = $this->db->get('myTable', $shift, $shift-5);
foreach ($query->result() as $row) {
echo "<a href='/schedule/{$row['id']}'>{$row['event']} at {$row['time']}</a><br>";
}
</td>
</tr>
</table>