• I am trying to batch process data using jquery Ajax and PHP. The problem is I am getting timeout issue because of the big data. The request never gets completed and the process dies in the middle.

    One way could be to run ajax for certain time and then return the available response in chunk as the request is not completed in a single request. So, to sort out this issue, I tried using setTimeout so that the ajax runs multiple times but only for fixed amount of time. However, I am stuck in the middle. Checked some threads over here but had no help.

    function UpdateStatus(){
        $.getJSON(
          "fetch.php",
          {
          },
          function (data, textStatus){
            setTimeout(UpdateStatus, 10000);
          }
        );
      }
      UpdateStatus();

    Can someone please shade some light on this?

    Any help would be more than appreciable.

Viewing 2 replies - 1 through 2 (of 2 total)
  • What’s your PHP Max Execution Time? What’s your PHP time limit?

    If the data is too big, may be you have to change the way you are doing this. You could:

    1. Run REST API from your server asynchronously (look up asynchronous curl or node.js)
    2. Query your server for status (maybe every 10 secs)

    Thread Starter saurav.rox

    (@sauravrox)

    Thank you @a2hostingrj for replying.

    The time limit is set maximum. I have already changed the default 30 seconds.
    The problem is I am not fetching data from database. If I had been working with database then may be I would be diving the data into chunk may be using Primary Id and all.
    I don’t know how to do in the situation where you don’t know how big of the data you are dealing with.
    I still believe this can be achieved using Php and jquery ajax.
    Can you please elaborate the points you have mentioned above?

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP and Jquery Ajax Batch Processing Big data’ is closed to new replies.