# Concurrent ajax requests

**URL:** <https://www.ruby-forum.com/t/concurrent-ajax-requests/97678>\
**Category:** Rails\
**Created:** [July 9, 2006, 4:06pm UTC](https://www.ruby-forum.com/t/concurrent-ajax-requests/97678 "2006-07-09T16:06:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrkohrea](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4491bb/32.png) [@mrkohrea](https://www.ruby-forum.com/u/mrkohrea)\
**Post date:** [July 9, 2006, 4:06pm UTC](https://www.ruby-forum.com/t/concurrent-ajax-requests/97678/1 "2006-07-09T16:06:14Z")

</div>

Hello,

maybe someone on this list can help me. I am trying to implement a sort  
of long  
database search. In order inform the user about what’s happening, status  
messages should be displayed to the user while the request is working.

e.g.

- starting search process
- currently searching through database A
- found 10 results
- currently searching through database B
- found 25 results
- currently searching through database C
- found 35 results
- …
- done

No, I’ve implemented this proposed solution:

[http://rails.techno-weenie.net/question/2006/6/12/status\_messages\_during\_a\_long\_running\_action](http://rails.techno-weenie.net/question/2006/6/12/status_messages_during_a_long_running_action)

but this does not work the way it’s assumed to work. What happens is  
that the  
status information is displayed only _after_ the search request has  
concluded  
the entire process.

As far as I understand, there’s a limitation with concurrent requests on  
behalf  
of the browsers. However, I am wondering, whether anybody, by any  
chance, might  
have run into a solution for this or maybe, has a work around.

Greetings

Michael K.

---

<div class="post-metadata">

**Author:** ![mrkohrea](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4491bb/32.png) [@mrkohrea](https://www.ruby-forum.com/u/mrkohrea)\
**Post date:** [July 9, 2006, 4:12pm UTC](https://www.ruby-forum.com/t/concurrent-ajax-requests/97678/2 "2006-07-09T16:12:37Z")

</div>

leave ajax. move to iframe.  
via the iframe you can send snippets with  
statusmessages/ progressbars, during the (long) processes.  
regards,  
robert

2006/7/9, Michael K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![mrkohrea](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4491bb/32.png) [@mrkohrea](https://www.ruby-forum.com/u/mrkohrea)\
**Post date:** [July 9, 2006, 4:21pm UTC](https://www.ruby-forum.com/t/concurrent-ajax-requests/97678/3 "2006-07-09T16:21:46Z")

</div>

Nope, I’ve tried that too. When you’re using an iframe, you still need  
to send a  
second request to the server in order to receive the status information  
of the  
first request.

It’s not working either.

Greetings

Michael K.

---

<div class="post-metadata">

**Author:** ![mrkohrea](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4491bb/32.png) [@mrkohrea](https://www.ruby-forum.com/u/mrkohrea)\
**Post date:** [July 10, 2006, 8:57am UTC](https://www.ruby-forum.com/t/concurrent-ajax-requests/97678/4 "2006-07-10T08:57:07Z")

</div>

I also had the same problem, even when I switched to lighty it seemed  
only one outstanding request  
could be made, and the periodic status requests didn’t get through until  
the first request finished.

I solved the problem using backgroundrb too, it worked and has a nice  
example of how to do status  
updates.

---

<div class="post-metadata">

**Author:** ![mrkohrea](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4491bb/32.png) [@mrkohrea](https://www.ruby-forum.com/u/mrkohrea)\
**Post date:** [July 9, 2006, 6:54pm UTC](https://www.ruby-forum.com/t/concurrent-ajax-requests/97678/5 "2006-07-09T18:54:55Z")

</div>

I had the same problem, but it was because i was using webrick for  
development.

You need a multithread webserver such as apache or lighttpd. I haven’t  
tried it with mongrel.

Another solution, a little more complex, but more impressive is  
backgroundrb… here is the link  
[http://brainspl.at/articles/tag/background](http://brainspl.at/articles/tag/background)

Roland
