Thanks for the suggestions Thadeus. I did think about using callbacks
to issue further requests, but I'm trying to keep the overhead down by
not establishing additional requests to the server. I mean the
connection is already open and waiting, so I guess I'm looking for a
way to send partial content to the browser from the controller
ideally. If not possible, I can fallback and use AJAX callbacks.

Any ideas on how to send partial content from a controller function?

Thanks!

-rob

On Sep 24, 1:37 pm, Thadeus Burgess <[email protected]> wrote:
> Perhaps you should run only one query at a time, and in your handler
> function specify a response.vars that tells it what query to run.
>
> In your ajax, have it callback using the first query, and in the success
> function, display the html, and then issue another callback for the next
> query.
>
> This way as soon one of the queries are finished the user is notified.
>
> Also, have a look at Nathan Freeze's clienttools.py, or my py2jquery.py that
> is based off Nathan's clienttools.
>
> Nathan's is better documented, mine is still under heavy development, but it
> is stable and works perfectly (its just not commented)
>
> clienttools -http://www.web2pyslices.com/main/slices/take_slice/8
>
> py2jquery -http://pastebin.com/m6dd0b53
>
> -Thadeus
>
> On Thu, Sep 24, 2009 at 12:29 PM, Rob Scheibel <[email protected]>wrote:
>
>
>
> > Seeing if anyone has any ideas on a better way to do this...
>
> > I've got a view that has a button. When the user presses the button,
> > an ajax call is made to one of my functions in a controller. This
> > function runs several large database queries. Currently, it returns
> > the results (simple small amount of html text) stating whether each
> > one was successful or not - but it doesn't return the results until
> > all are complete.
>
> > As you can guess, the user is sitting there for awhile waiting for
> > some sort of response.
>
> > Is there anyway to make a call from the function in the controller to
> > return the response of each query after it happens rather than waiting
> > until they all run? No view is necessary to render here, again it's
> > just a small line of html text (i.e. in Red saying failed or green
> > saying passed). The AJAX call just appends the output to a div.
>
> > I've thought about having a function for each DB query and then
> > calling the next function after the first one runs in the controller,
> > but I only get 'None' as a response so something isn't quite right in
> > that regards...
>
> > Thanks in advance!
>
> > -rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to