> A php script is always pending and will push a data to the browser
> once detected a changes in the database (And its already done). But
> the problem is I cant catch the pushed data in onSuccess event or in
> onComplete event of Request object.
This pattern is called "Ajax long polling." It's quite serviceable for
apps that need to be flat cross-modern-browser (without progressive
enhancement) and when you're not using an actual evented back-end
(i.e. you are using PHP). (Some would say it's dangerously
unscaleable, but let's ignore that caution for now.)
In other words, this should work just fine. Nothing fancy but also
nothing that Moo isn't built to handle. The connection runs for a long
time, it finally gets something, it calls onSuccess. To the client
with a reliable connection, it's no different from a short Ajax call
and uses fewer resources on the client than if you had the client loop
constantly.
You say the PHP script is working fine. What happens if you return
dummy data immediately without polling/waiting for any changes in the
database? Then work with PHP's sleep() command to add a delay with no
other complications. Only then plug in your actual db code. Is PHP
timing out (see set_time_limit(0)) when you use the real db code? This
is how you'd troubleshoot such things.
-- S.