Results 1 to 3 of 3

Thread: display data with ajax or what?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    display data with ajax or what?

    i have a script which asks for a URL and when submitted it executes for 10 to 30 minutes. And save the data into .txt file also echo the data on web page

    But the result is displayed when execution of the script is finished.

    I want to know how can i get data displayed line by line whenever there is new echo in the script result

  2. #2
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: display data with ajax or what?

    How are you doing it now? Also, do you have a server-side script scraping the pages or are you expecting your ajax call to do it? If you're using ajax to call another server, you're probably going to run into CORS issues.

  3. #3
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,537

    Re: display data with ajax or what?

    I suspect the call currently isn't AJAX and is just simply PHP running....
    switching it to an AJAX call though is likely going to be a major undertaking, and going to require some fundamental changes in the architecture which will affect the processing process.

    You'd have a basic page that's going to display to the user and make the initial AJAX call... that AJAX call then invokes a web service... but it's still going to pause and wait for that service to finish before the AJAX call will return... so if the process still takes 20 minutes, it will wait 20 minutes before it can return and update the display.

    So what you'll need to do is some how cache the results from the process, then make multiple AJAX calls to get the cached results and displaying that until there are no more results to get. Now how to do that... shrug... don't know... depends on what you're doing and how you're doing it. It might mean the status is written to a database and you read the results from there, or it might mean something completely different.

    Bottom line, you'll need two methods to invoke... the first kicks off the process in the first place... the second would be to get the results.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width