[eluser]LuckyFella73[/eluser]
This is a code snipped I used to update my view:
Code:
var interval;
function Check_session() {
$.ajax({
url: ci_base_url + "controller_name/method_name",
dataType: "json",
success: function(data) {
if (data.new_record == true) {
closeInterval();
// view update logic - display message - new post
}
}
});
};
function startInterval(sec){
interval = setInterval(function(){
Check_session();
}, sec);
};
function closeInterval(){
clearInterval(interval);
};
startInterval(10000); // set your own value here
The var "ci_base_url" can be set hardcoded - I echo the value
using base_url() in my page header:
Code:
<scr +++ ipt type="text/java +++ script">
var ci_base_url = '<?php echo base_url();?>';
</scr +++ ipt>
I assume you load jquery to do the ajax request ..
Hope that get you on the right track.