• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

AJAX Flicker?

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a real time moniting page on a browser that gets updated every second using AJAX approach. Code looks as follows:



Every second update of the screen works pretty neatly on IE; however on Firefox/Netscape the screen flickers. Any idea on things to try to fix this?
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just glanced over that code very quickly. If you keep replacing the content on the page. Mozilla is going to flicker. I personally would do this, cache your request into a variable. Next time the request is made compare the new reult with the one you stored. If they are the same do not process the data. If they differ then process and store this into the cache.

It will save CPU on the user's computer and would get rid of the flicker.

Eric
 
Prakas Subed
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eric,

Thanks for the suggestion. However, the data is expected to change many times within each second. We have been lucky to have a requirement to refresh data only once per second.

Now, does this mean AJAX will not work for near-real time monitoring systems on at least IE and Firefox/Netscape?

Prakas

Originally posted by Eric Pascarello:
I just glanced over that code very quickly. If you keep replacing the content on the page. Mozilla is going to flicker. I personally would do this, cache your request into a variable. Next time the request is made compare the new reult with the one you stored. If they are the same do not process the data. If they differ then process and store this into the cache.

It will save CPU on the user's computer and would get rid of the flicker.

Eric


[ November 16, 2005: Message edited by: Prakas Subed ]
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are going to be killing your server with a request a second!!

You are going to get flicker if you have to keep rendering the page over and over.

Eric
 
Prakas Subed
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I understand your concern; number of users accessing the screen is sized to be less than 3 at any time. We'll have a JBoss server running on Linux (fairly sized; possibly dual processor with plenty of RAM). i.e. we can add more hardware/processing power as necessary. i.e. we'll stand up reasoable server that will live there to serve. Therefore, hit to server is a non-issue for us.

Also, there's no flicker on IE. Flickering on Netscape/Firefox is the issue -- why there's no flicker on IE and yet there's a flicker on Firefox/Netscape? Makes me disappointed to implement AJAX approached solution to find out it doesn't work on Firefox/Netscape.


Originally posted by Eric Pascarello:
You are going to be killing your server with a request a second!!

You are going to get flicker if you have to keep rendering the page over and over.

Eric

 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is not Ajax, it is how the browser is re-renderinig the page.

The question lies in how are you outputting the data to the page? Some general code may help to get to the bottom of the problem.

Eric
 
Prakas Subed
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eric,

The way data is outputed to the page is replacing a span with html received from the server:



Originally posted by Eric Pascarello:
It is not Ajax, it is how the browser is re-renderinig the page.

The question lies in how are you outputting the data to the page? Some general code may help to get to the bottom of the problem.

Eric

 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you are doing to have to deal with the flicker on the page, that is the way Gecko renders it.

I would add this so if the data does not change you will not see the rendering.

if(strLast != req.responseText){
document.getElementById("theTable").innerHTML = req.responseText;
strLast = req.responseText
}


Eric
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Try using DOM, instead of .innerHTML = ... to update your table

Taconite home page ( http://taconite.sourceforge.net ) contains an intresting description of the innerHTML problem.

Don't forget to let un know if it works ;)
 
Our first order of business must be this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic