Welcome Guest, Not a member yet? Register   Sign In
Jquery Firefox Bug
#1

[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:
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);
            }
My view File
Code:
<div id="newest_works">
    <h2>&lt;?php echo $site_nieuwste; ?&gt;</h2>
    <div id="page_works">
        &lt;?php
            echo $newest_works;
        ?&gt;
        <div id="pageLinks">
        &lt;?php
            echo $create_pagination;
        ?&gt;
        </div>
    </div>
    <div class="clear"></div>
</div>

If somebody could help me i would be very thankfull

Joachim
#2

[eluser]rdjs[/eluser]
Try adding a

Code:
return false;

at the end of your update function.
#3

[eluser]yorvik[/eluser]
I added return false , but that did not solve the problem.

Somebody who sees the problem?
thanks in advance

Joachim
#4

[eluser]Victor Michnowicz[/eluser]
It may be a missing semicolon.

Code:
window.setTimeout( function(){                      

    $('div#page_works').html(html);  
    //$('div#page_works').slideDown(800);
    $('html, body').animate({scrollTop: $(document).height()}, 900);

}, 100);
#5

[eluser]yorvik[/eluser]
I added the ; But that still did not solve the problem.

Somebody who can help?

Thank in advance

Joachim
#6

[eluser]cideveloper[/eluser]
It has to do with your 302 redirect from http://www.svensonart.com/test/index.php...me/index/8 to http://www.svensonart.com/test/index.php...me/index/8
#7

[eluser]yorvik[/eluser]
[quote author="cideveloper" date="1297289975"]It has to do with your 302 redirect from http://www.svensonart.com/test/index.php...me/index/8 to http://www.svensonart.com/test/index.php...me/index/8[/quote]

I found my problem.
Code:
$config['base_url'] = base_url().'/index.php/home/index/';

Replaced to

Code:
$config['base_url'] = base_url().'/index.php/nl/home/index/';
Thanks cideveloper for point out the right direction Smile

Problem Solved!




Theme © iAndrew 2016 - Forum software by © MyBB