I’m working on a website which recommends videos to people. The recommendation system exists on a server which I poll and receive an xml file in return.
The problem is this recommendation system is still under development and it can take 5+ seconds to receive a response. So I need to develop a loading .gif on the page that will act as a placeholder until the xml file is generated.
The problem is I parse the xml file using PHP so when I try to load the page, it just stays white until the xml is parsed. How do I make it load all the html elements of the page first, and then the recommendations only when they’re fully loaded?
You need to load the recomendations via AJAX, for example:
If you prefer you can return the information in your PHP file in JSON or XML format.