Welcome Guest, Not a member yet? Register   Sign In
javascript .load()
#1

[eluser]threestate[/eluser]
Hi everyone,
i'm having a bit of an issue. In straight php or html, no problem, but using codeigniter (which i'm new to) i have a bit of a problem

i have a page with a sidebar, inside that sidebar is a div called #my_time.
what i'm trying to do is use javascript to force a refresh of that div every x minutes

the div is loading a view
Code:
<?php $this->load->view('includes/time'); ?>
and the javascript is:
Code:
setInterval(function() {
         $('#my_time').load('time'); //controller time.php
    }, 250);

now, if i load a page that doesnt require a parameter (like, my list news page) this works great, the div is reloaded with the content from the time controller (currently just echoing Hello World)
however, if i navigate to a page that requires a parameter (like a news detail page), i get errors thrown. these errors only display in the div i'm loading, and the rest of the page displays as it should. (Message: Trying to get property of non object) i get an error for the main controller of the page i'm on, basically because it's for some reason looking for the parameter to be passed.

what am i doing wrong?




Theme © iAndrew 2016 - Forum software by © MyBB