How to access ReadyState using COM with Ajax call

Hi,

I’m writing an automation script in another language to perform some actions on a web page.

I’m using COM to access the page DOM and querying the ReadyState==4 to asses weather the page is loaded or not.
I get a problem when I try to apply this method to a part of the page that is loaded via Ajax. ReadyState remains 4 because the page itself is not loading.

Is there a COM object that represents part of a page that is being loaded via Ajax?

Here is what I’m using at the moment (In AutoHotkey):

pwb := ComObjCreate( "Shell.Application" ).Windows
pwb.FullName := "iexplore.exe"
pwb.document.all.search.click()
while, pwb.ReadyState != 4
	Sleep, 10
; carry on with other code

The above works when the call the click() reloads the whole page, but not if it calls on Ajax.

Any ideas?

David