检测时,AJAX在web浏览器的DIV改变HTML [英] Detect when AJAX changes HTML in a DIV in WebBrowser

查看:123
本文介绍了检测时,AJAX在web浏览器的DIV改变HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


当我通过web浏览器加载一个网页,我点击了触发一个AJAX脚本的链接,我需要当AJAX Java脚本完成加载HTML变成一个div来检测。由于AJAX脚本运行时没有DocumentCompleted事件被解雇,我不知道什么时候完成运行。有没有一种方法,我可以将要引发的事件后,我知道100%的JavaScript完成更改分区?
该项目是在C#。
谢谢


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

推荐答案

我最近做了类似的事情(使用jQuery):

I did something similar recently (using jQuery):

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

当然,我也使用jQuery来设置div的HTML。我想一个非jQuery的方式进行,你可以通过你自己的函数,这反过来又可以触发一个onchange事件来设置HTML。

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在镇:从我的经验,这是不正确的。我用这个在多个资料核实,从来没有获得焦点摆在首位,而且运作良好,并一致。正常的行为是象你所说的,通常只适用于INPUT和SELECT元素,但这不是与jQuery的情况。

@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.

这篇关于检测时,AJAX在web浏览器的DIV改变HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆