Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7930691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:30:21+00:00 2026-06-03T20:30:21+00:00

I have a page that includes various blocks of information retrieved from db. Those

  • 0

I have a page that includes various blocks of information retrieved from db. Those blocks are arranged into sections and currently all that code is withing a long PHP page, so every time I load a page, there’s a delay with its display. I would like to be able to load the page faster and place some sort of “loading…” or image placeholder in the section where the content will be loaded. I see it done frequently on other sites. How do I accomplish that? Do I need to break my long PHP page into:

  1. Main layout page

  2. Place each block with data from db into a separate page, and

  3. Use includes to insert into main page.

How would I place “loading” while the content is being generated?

Just trying to better understand the process. I also use jQuery. Perhaps there’s a pluging that can help with this?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T20:30:22+00:00Added an answer on June 3, 2026 at 8:30 pm

    Include in your main layout page only those elements that you would like to be visible when the page initially loads. You should have placeholder elements with IDs that can be accessed via JavaScript where you would like content that you will be fetching from the server.

    Use jQuery’s ajax function to load the content from a separate request to the server:

    $.ajax({
        url: '/path/to/script.php',
        data: 'any=get&variables=you&would=like&to=set', // can also be passed as an object
        success: function( html ) {
            // The argument passed to the success function is ALL of the output 
            // of your 'script.php'
            $('#containerid').html( html );
    
        }
    });
    

    In your backend PHP script, simply echo out the content that you want to show up. You can optionally pass the content back as a JSON object, which is a more preferred method but requires more processing on the client side (the object must be parsed first before it can be accssed. See PHP’s json_encode function and JSON.org for more info on JSON).

    Structured this way, it makes the most sense to me to make 1 ajax request per container that you would like to fill.

    Please also check out the reference page for jQuery’s ajax function

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page that includes a GridView in it. That GridView is paged
I have a page that includes a dynamic js-script depending on the page I'm
I have created a web page (ASP.NET) that includes a stylesheet to mimic Dynamics
I have a index.php page that is the main page. All pages are included
I'm building a header for a website that includes skylines from various cities. To
I have an index.html.erb page timesheet that has various js and jquery tables and
I have a page that is included as an iframe in my site. I
I have a JSF page that is included in other JSF pages (basically a
I have a page that uses another page via the include() function. The page
I have a page that builds out a table. Nothing else on that page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.