Will CakePHP not be able to process two Ajax requests at the same time?

This is the third time I am editing this post, after more rigorous testing and debugging, I continue to find new things. Here is my situation:

I have a method thinkerthat takes time to process. Because of this, I decided to call through Ajax and show the indicator to the user. Up to this point - it works fine.

Another thing I'm trying to do is actually show the user the progress of "thinking", in percent or just ticks, whatever.

This is not difficult to do, because it thinkerhas a loop, and at each iteration it saves a new one thoughtsto the database.

So, basically - it counterjust shows the number of "thoughts" (tied to a specific identifier).

The problem is that the callback function is not called.

Ok - scratch it - it's called out, but only twice. Before the request (shows zero) and after thinker, thinking is performed when it is no longer used (show the total amount).

Here's the simplified code:

<span id="indicator" style="display: none;"><img src="/img/ajax-loader.gif" alt="" /></span>
<span id="progress"></span>
<span id="clicker" style="cursor: pointer;">Do it!</span>

<script type="text/javascript">
//<![CDATA[
Event.observe('clicker', 'click', function(event) {
  new Ajax.Request(
    '/examples/thinker/123', 
    {asynchronous:true, evalScripts:true, onComplete:function(request, json) {Element.hide('indicator');}, onLoading:function(request) {Element.show('indicator');}}
    );
  new Ajax.PeriodicalUpdater(
    'progress', 
    '/examples/counter/123', 
    {asynchronous:true, evalScripts:true, frequency: 2}
    );
  });
//]]>
</script>

EDIT:

Thanks to the use of the Firebug XHR console, I was able to go a little deeper into this. I really went with jQuery (just checking, but that didn't help).

CakePHP, . - PHP, . Cake, counter , thinker , counter , , thinker .

, Cake ?

,

+3
2

, , , Cake. CakePHP ( php.ini ). :

CakePHP .

:

Configure::write('Session.save', 'php');

Configure::write('Session.save', 'cache');

, .

+2

, . , . script , . . , , / . , , .

, .

0

All Articles