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

  • SEARCH
  • Home
  • 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 6132359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:05:36+00:00 2026-05-23T17:05:36+00:00

I have a site that get content from other sites with some JSON and

  • 0

I have a site that get content from other sites with some JSON and XML API. To prevent loading problems and problems with limitations I do the following:

  1. PHP – Show the cached content with PHP, if any.
  2. PHP – If never cached content, show an empty error page and return 404. (The second time the page loads it will be fine “success 200”)
  3. Ajax – If a date field does not exist in the database, or current date is earlier than the stored date, load/add content from API. Add a future date to the database. (This makes the page load fast and the Ajax caches the content AFTER the page is loaded).

I use Ajax just to run the PHP-file. I get the content with PHP.

Questions

  1. Because I cache the content AFTER it was loaded the user will see the old content. Which is the best way to show the NEW content to the user. I’m thinking automatically with Javascript reload the page or message-nag. Other prefered ways?
  2. If I use very many API:s the Ajax loadtime will be long and it’s a bigger risk that some error will accur. Is there a clever way of splitting the load?

The second question is the important one.

  • 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-05-23T17:05:36+00:00Added an answer on May 23, 2026 at 5:05 pm

    Because I cache the content AFTER it
    was loaded the user will see the old
    content. Which is the best way to show
    the NEW content to the user. I’m
    thinking automatically with Javascript
    reload the page or message-nag. Other
    prefered ways?

    I don’t think you should reload the page via javascript, but just use Jquery’s .load(). This way new content is inserted in the DOM without reloading the entire page. Maybe you highlight the newly inserted content be adding some CSS via addClass().

    If I use very many API:s the Ajax
    loadtime will be long and it’s a
    bigger risk that some error will
    accur. Is there a clever way of
    splitting the load?

    You should not be splitting content in first place. You should try to minimize number of HTTP requests. If possible you should be doing all the API calling offline using some sort of message queue like for example beanstalkd, redis. Also cache the data inside in-memory database like for example redis. You can have a free instance of redis available thanks to http://redistogo.com. To connect to redistogo you should probably use predis

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

Sidebar

Related Questions

I have a site written in Delphi that needs to get data from a
I have a site that has a /sites/default/files/ directory where user content is typically
I have a site that displays other sites through an iframe on certain pages.
I have a site that makes use of GET variables to determine what to
We have a site that is serving some RSS feeds, and we'd like to
I'm trying to get content from external feeds on my Django web site with
I have someone complaining that www.archstl.org (a site I manage) loads fine from his
I got some simple CSS from http://www.cssstickyfooter.com/ to get a footer that always sticks
I have a site that i want to redirect all requests accept for 1
I have a site that allows download or streaming of mp3 files. All the

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.