How to reload a page with load.gif?

Asked

Viewed 233 times

0

Dear, how do I make the page reload so it doesn’t "blink"? I can leave a GIF on the screen while the page is reloaded?

    $('#objetivos-form').live('submit',function(){

        var form = $(this);
        // validando
        if (             
            form.find('input[name="objetivo[]"]:checked').val() == '' ||        
            form.find('input[name="objetivo[]"]:checked').val() == null      
        ){
            message.erro('Escolha um objetivo!', '#result');                

        } else {

            $.post( form.attr('action'), form.serialize(), function(result){
                $(".descubra-objetivo").fadeOut();                   
                // location.reload();

                $(".descubra-alterar").fadeIn();
            });
        }    
        return false; 
    });

2 answers

1

The only way to ensure that a page does not blink or show-and-hide content (because javascript is not immediate) is via CSS.

All content that will be changed by CSS "immediately", ie on onLoad or DOMready page has no other way to ensure behavior than via CSS.

So the suggestion is to have display: none, visibility: hidden, or opacity: 0 and change via javascript when the page opens.

In addition to the above, all changes that are made on a page (on the client side) are lost when the page is loaded again.

  • Thank you for the @Sergio reply. The problem is that I am obliged to reload the page because there is a small snippet of PHP code where it queries for metadata and displays on the page.

  • @Marcelodeandrade, you can upload data via ajax without having to reload the page. Knew it?

  • Yes, @Sergio. I’m just looking for some alternatives to what I need. I am using the [http://elgg.org/] Elgg framework and testing the possibilities.

  • @Marcelodeandrade I answered in response to the information you put in the question. If you have another problem or a more specific problem put it in the question or create a new question. From the link you sent me it seems to me that a partial page Reload solution (ajax) is ideal.

1


  • Thanks for the suggestion, Luis Fernando. I managed to implement with your tip and already meets my need. Thanks also @Sergio.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.