JohnnyDoomo Posted October 27, 2015 Share Posted October 27, 2015 I'm attempting to use the preloader from here: https://www.niklausgerber.com/blog/preloadme-a-lightweight-jquery-website-preloader My problem is that I have a line that includes a php file. This php line goes out and grabs rss feeds from other sites, and it takes roughly 10 seconds to process. My problem is, when using the above mentioned preloader, the page sits for the time it takes for the php to process, then quickly flashes the preloader, and then the site that uses the gathered rss info. I don't know php or JS, but want to get this to work, so that the JS lines and page show, while that include statement is loading the php, and gathering the rss info. Is there any easy way to do this, when I don't know php or JS? Any help is greatly appreciated. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/298850-trying-to-get-js-preloader-to-show-before-php-is-done/ Share on other sites More sharing options...
Psycho Posted October 27, 2015 Share Posted October 27, 2015 Is there any easy way to do this, when I don't know php or JS? Short answer, No. You could either learn enough to accomplish what you want to achieve or find someone who will do it for you (possibly for a fee). But, I can provide some insight as to the problem. When a request is made to a server for a PHP page, the server will complete all of the action within that script (and included scripts). Once all processing is complete it will then send the completed page to the user. There are a lot of exceptions to that, but for your situation it applies. Then once the user's browser receives the page, any JavaScript in that page can then execute. The solution to your problem would likely be to make an AJAX call to get the RSS feed data. So, the page you have now should just create a container to put the RSS output and remove the PHP line that goes to get the content. Then, in addition to having JavaScript code to preload the images, you would implement an AJAX call to a PHP page to just return the RSS content that you would then populate on the page with JavaScript. This may sound complicated, but there is a framework called JQuery that would make this rather easy. But, if you don't know any coding it could take a while to figure out how to implement it. http://api.jquery.com/load/ Quote Link to comment https://forums.phpfreaks.com/topic/298850-trying-to-get-js-preloader-to-show-before-php-is-done/#findComment-1524442 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.