Tell me more ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

I'm trying to run PHP code in a Facebook application, but it gives a blank screen for 20 seconds or so. The PHP code is not efficient I know this, but I can't change it, it's because of some queries.

I'm looking for a way to have the HTML page printed on the screen before the PHP code is finished.

I tried everything from inserting flush(), ob_flush() statements within the PHP code, so it would print the HTML already... I tried adjusting the php.ini file because I read that it's possible that the server doesn't react to flush() statements etc. and that you have to change it there (my server is with GoDaddy), but that didn't work either!

So I'm looking for a way to have my HTML page on screen and reference to a PHP code that runs in the background, that way my users don't have to stare at a blank screen.

share|improve this question
Can you request AJAX from your 1st part of HTML code (which is actually printed with 1st part of your PHP code)? Then it will run your 2nd part of PHP code. – Alex Pavlov Oct 11 '12 at 14:00
Please repost this on Stack Overflow with your code that's not working. – ChrisF Oct 11 '12 at 15:55

closed as off topic by Alex, Al Everett, ChrisF Oct 11 '12 at 15:55

Questions on Web Applications Stack Exchange are expected to relate to web applications within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

Browse other questions tagged or ask your own question.