Wednesday, May 4, 2011

Cake dispatcher is synchronous?

Hello all,

I was doing a little experiment when I found a curious behavior. Here is the setup:

I have a view bookprices.ctp, which shows a list of books (12 books), and for each of these books, fires an ajax call to "books/getprice" (controller books, action getprice), in order to get the price of the book. While the prices are not loaded, I have a little "loading" gif show up instead of the price. The ajax call is done by calling a "getPrice" javascript function, which is coded in the bookprices.ctp file, and uses prototype.js.

Testing with Firebug, I noticed that all calls to getPrice are fired at the same time, which is expected behaviour. However, the results arrive *sequentially*. Only after getting the price of the first book is it possible to query the "books/getprice" url again.
Doing the same test without cakephp, I notice that things happen in parallel, which is the desired behaviour (and this is what made me think that the problem might be with cake).

My question is therefore:
- how can I tell cake to handle requests in an asynchronous manner ?
- if the above is not possible, how do I redesign my files so that I get the desired behaviour here?

Thanks,
ojonam

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: