How to know if a page with Ajax has fully loaded, using Javascript?

I am using Selenium RC with Java to automate pages which have ajax elements and i want to calculate the time it takes for the page to fully load.
I've tried         selenium.waitForCondition("selenium.browserbot.getCurrentWindow().Ajax.activeRequestCount == 0;", DEFAULT_WAIT_PERIOD);
but it returns as undefined. It doesn't help that i don't know the Javascript library that my page is using. The above line works for Prototype. I've tried the equivalent for JQuery and Dojo, but no luck.
Is there a way for me to track how many XMLHttpRequests went out and how many came back?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The info is in the readyState attribute of the XMLHttpRequest object used.

Most of time we use a callback function, for example with jQuery :

$.get("path/to/url.ext", function() {
  // callback part

Open in new window

Else we use a synchrone ajax call

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Thanks for the points!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Quality Assurance

From novice to tech pro — start learning today.