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 7577515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:12:28+00:00 2026-05-30T17:12:28+00:00

I have constructed a PHP file which scrapes a web page (using cURL) to

  • 0

I have constructed a PHP file which scrapes a web page (using cURL) to obtain some data, and outputs it to the screen in JSON format.

The target website involves some redirects which temporarily outputs data to my PHP file. Once the redirects have completed successfully, the JSON is presented as expected. The problem that I am encountering is that when I try to access the JSON using jQuery’s $.ajax() method, it sometimes returns the incorrect data, because it isn’t waiting for the redirects to complete.

My question is if it’s possible to tell the AJAX request to wait a certain number of seconds before returning the data, thus allowing time for the redirects in the PHP script to execute successfully?

Please note that there is no cleaner solution for the page scrape, the redirects are essential and have to be outputted to the screen for the scraping to complete.

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

    There’s always timeout in the settings.

    jQuery docs:

    timeout Number

    Set a timeout (in milliseconds) for the request. This will
    override any global timeout set with $.ajaxSetup().
    The timeout period starts at the point the $.ajax call is made;
    if several other requests are in progress and the browser
    has no connections available, it is possible for a request
    to time out before it can be sent. In jQuery 1.4.x and below,
    the XMLHttpRequest object will be in an invalid state if
    the request times out; accessing any object members may
    throw an exception. In Firefox 3.0+ only, script and JSONP
    requests cannot be cancelled by a timeout; the script will
    run even if it arrives after the timeout period.

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

Sidebar

Related Questions

Greetings, I have a particular object which can be constructed from a file, as
Suppose, I have a lot of classes, which are constructed using Java reflection (for
I have a script which calls an external API using curl. This script worked
I'm having problem with global variable in PHP. I have mysqli config file which
Need some help with inclusion of outside variables. I have this file lang.class.php class
I have constructed an XML tree structure of an XML file. I am able
I have a php script the I often run using CLI (regular ssh terminal).
I have a class which is : <?php class FileObject{ private $name; private $arr;
I have an index.php file that has 3 includes <?php require_once('mod.php'); $mod = new
Well I have a problem reading the JSON data in jQuery, which is outputted

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.