02-08-2011, 05:47 PM
[eluser]yorvik[/eluser]
Hello guys I am making a pagination page with the CI pagination class. My Requests are done by AJAX. In Chrome , Safari , IE everything works fine. But in Firefox I get a bug because the whole html page is resend.
preview
This is my Jquery Code:
This is My controller code:
My view File
If somebody could help me i would be very thankfull
Joachim
Hello guys I am making a pagination page with the CI pagination class. My Requests are done by AJAX. In Chrome , Safari , IE everything works fine. But in Firefox I get a bug because the whole html page is resend.
preview
This is my Jquery Code:
Code:
function showBusy(){
//$('div#page_works').slideUp(800);
}
function updatePage(html){
window.setTimeout( function(){
$('div#page_works').html(html);
//$('div#page_works').slideDown(800);
$('html, body').animate({scrollTop: $(document).height()}, 900);
}, 100)
}
$(document).ready(function() {
// change page to ajax_page in pagination urls
$('ul#pagination > li a').live('click',function(e){
e.preventDefault();
var link = $(this).attr('href');
$.ajax({
url: link,
type: "GET",
dataType: "html",
beforeSend: function(){
showBusy();
},
success: function(html) {
updatePage(html);
}
});
});
});
This is My controller code:
Code:
$config['total_rows'] = $this->svensonart->get_num_works();
$config['per_page'] = $limit;
$this->pagination->initialize($config);
if(IS_AJAX)
{
$new_list = $this->table->make_columns($this->svensonart->get_newest_works($limit, $offset), 4);
echo $this->table->generate($new_list);
echo '<div id="pageLinks">'.$this->pagination->create_links().'</div>';
}
else{
$data['create_pagination'] = $this->pagination->create_links();
// Make table of returned db rows => a limit of 4 columns
$new_list = $this->table->make_columns($this->svensonart->get_newest_works($limit, $offset), 4);
$data['newest_works'] = $this->table->generate($new_list);
$data['main_content'] = 'home_view';
$this->load->view('includes/template', $data);
}
Code:
<div id="newest_works">
<h2><?php echo $site_nieuwste; ?></h2>
<div id="page_works">
<?php
echo $newest_works;
?>
<div id="pageLinks">
<?php
echo $create_pagination;
?>
</div>
</div>
<div class="clear"></div>
</div>
If somebody could help me i would be very thankfull
Joachim