Hi all, I am developing one application using PHP, jQuery, Javascript in CodeIgniter.
I included script.js file in view file. The problem is the view file is continuously loading again and again with in the result div called "new".
Please help me. Below are the files and code.
View file
<?php $this->load->view('header'); ?>
<script type="text/javascript" src="<?php echo base_url();?>js/script.js"></script>
<div id="content">
<div id="news">
</div>
</div>
script.js
has the following code:
$.post('news/getnews', function(data) {
$('#news').append(data);
});
In controller,
function getnews()
{
echo some data.
}
It only loading the result again and again when I use Post, ajax etc methods. i.e, when I try to get data from controller and append to view using Javascript.
Thanks, Raj