且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何跟踪HTML页面上的内容更改页面加载后

更新时间:2023-12-03 08:06:04

如果你正在使用AJAX,你可以设置响应函数来处理增长事件监听系统的家庭。所以后的反应做什么,它需要做的,它可以调用被注册了它的任何方法,通过在响应文本必要时。

If you are using AJAX, you could setup the response function to handle a home grown "event listening" system. So after the response does what it needs to do, it could call any methods that were registered with it, passing in the response text when necessary.

所以从你的例子上面,在练习1,当AJAX从S1返回,这将加载S2,然后调用一个方法说S2发生了变化。在练习2,当新的AJAX返回DIV的内容,加载到DIV后,它调用不同的方法(也可能是同一取决于你试图做什么),并提醒其该div有新的内容。

So from your examples above, in Ex1, when the AJAX returns from S1, it would load S2, then call a method saying S2 had changed. In Ex2, when the new AJAX returns the DIV's contents, after loading it into the DIV, it call a different method (or possibly the same depending on what your trying to do) and alerts it that the DIV has new contents.