Results 1 to 3 of 3

Thread: How to prevent page flickering and no loader?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    782

    How to prevent page flickering and no loader?

    Hi,

    I'm trying to refresh a dashboard on my home page, the page is flickering with a loader, how to prevent it?

    Code:
                                                  
     $.ajax({
          type: 'post',
          url: 'home/index',
          data: {},
          success: function (response) {
              $('#dashboard').html(response);

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,711

    Re: How to prevent page flickering and no loader?

    You are not providing us with enough information. Is the flickering happening when you set the HTML of the $('#dashboard') element?
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  3. #3
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: How to prevent page flickering and no loader?

    Try this:

    Code:
    $('#dashboard').hide().html(response).show();
    Of course, I am making assumptions on what #dashboard is. I'm guessing a DIV. If that DIV has borders and what not, then .HIDE() and .SHOW() on that might flicker as well. If so, put a DIV inside #dashboard and hide/fill/show that.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width