After I load a page through a WebBrowser, and I click a link that fires an AJAX script, I need to detect when the AJAX java script finishes loading HTML changes into a div. Since no DocumentCompleted event is fired when the AJAX script is run, I don't know when it finish running. Is there a way I can attach an event to be raised after I know 100% that the javascript finished changing the div?
The project is in C#.
Thanks
Asked
Active
Viewed 2,634 times
2

Pascal
- 2,944
- 7
- 49
- 78
-
How about the AttachEventHandler command? Can it be used to solve this? – Pascal Sep 21 '09 at 13:24
2 Answers
1
I did something similar recently (using jQuery):
$('#mydiv').change(function(){
// do stuff
}
);
Granted, I also use jQuery to set the HTML of that div. I suppose one non-jQuery approach for you could be to set HTML through your own function, which in turn can fire an onchange event.
@New in town: From my experience that is not correct. I use this on multiple DIVs that never get focus in the first place, and it works well and consistently. The normal behavior is as you describe, and normally only applies to the INPUT and SELECT elements, but this is not the case with jQuery.

Brother Erryn
- 841
- 1
- 5
- 9
-
I'm afraid this The "change" event only fires when the element loses input focus (provided the value has been changed). – Sep 21 '09 at 13:25
-
You can use jQuery with .Net. Stackoverflow itself makes heavy use of jQuery. – acrosman Sep 21 '09 at 13:48
0
There is no event. You must patch the JavaScript callback that the browser runs when the reply for the AJAX request comes in. This will contains code like "div.innerHTML = ...". Just put your code below that.

Aaron Digulla
- 321,842
- 108
- 597
- 820
-
I have no control over the script that's loaded, since it's a third party page. – Pascal Sep 21 '09 at 13:25