Aaron Smyser
Aaron Smyser

Reputation: 3

Page Renders before data pull is complete

I have two columns.

The column on the left renders first (obviously). The column on the right is injected code that is built from a data pull. The column on the right finishes rendering the page before the data is loaded and visible. Therefore the right column is blank, unless I refresh the page several times.

Is there a way to slow down the page rendering? The page renders properly in ie, but not ff and chrome.

Upvotes: 0

Views: 77

Answers (2)

Lie Ryan
Lie Ryan

Reputation: 64923

No but you can delay rendering the right column until your ajax call are completed. Depending on the Javascript library you're using, or if you're using raw Javascript, there should be a way to register a callback function to be called back when the data finished downloading from the server.

Load your data in this callback instead of relying on delaying for a specific amount of time, because that will always be wrong, too slow for some users and too fast for other users.

Upvotes: 0

Gus
Gus

Reputation: 6881

I doubt you actually want to slow down the page render since that will annoy you users. What you probably want to do is improve your code so that it properly replaces the content of the div (or whatever) that holds your right column. Use an library like jQuery to make the request for the content as an AJAX call. Without code examples I can't give you anything more specific.

Upvotes: 1

Related Questions