Detect when AJAX changes HTML to DIV in WebBrowser

After loading the page through WebBrowser, and I click on the link that launches the AJAX script, I need to determine when the AJAX java script finishes loading the HTML changes to the div. Since the DocumentCompleted event does not fire when the AJAX script starts, I don’t know when it will finish. Is there a way that I can attach an event that will be generated after I find out 100% that javascript has finished changing the div?
The project is in C #.
Thanks

+2
source share
2 answers

I did something similar recently (using jQuery):

$('#mydiv').change(function(){ // do stuff } ); 

Of course, I also use jQuery to set the HTML of this div. I suggest that one approach other than jQuery could be to set the HTML through your own function, which in turn can fire the onchange event.

@New in the city: From my experience this is not true. I use this on several DIVs that never get focus in the first place, and it works well and consistently. The usual behavior, as you describe, and usually only applies to INPUT and SELECT elements, but this does not apply to jQuery.

+1
source

There is no event. You must fix the JavaScript callback that the browser launches when the response for the AJAX request arrives. It will contain code like "div.innerHTML = ...". Just put your code below.

0
source

Source: https://habr.com/ru/post/893210/


All Articles