使用jQuery监听正在使用jQuery.AJAX没有加载一个AJAX负荷 [英] Using jQuery to listen for an AJAX load that is not loaded using jQuery.AJAX
问题描述
好了,都有点棘手的一个(对我来说,无论如何,我是pretty的垃圾在jQuery的/ JavaScript的)。
Okay, have a bit of a tricky one (for me anyway, i'm pretty rubbish at jQuery/JavaScript).
我使用的是标准的AJAX拉动数据(即不使用像jQuery或诸如此类的东西的框架...有个理由吧)
I'm pulling in data using standard AJAX (ie, NOT using a framework like jQuery or whatnot... there is a reason for it)
不过,我则需要尽快加载一个jQuery脚本的页面已被加载。所以,这里是一个问题,我怎么绑定脚本,一旦DOM已经更新?我一直用碧浪Fleser的听的插件(http://flesler.blogspot.com/2007/10/jquerylisten.html)有关事件的回升,如点击其中工程一种享受,但我可以看不到这可怎么使用的听的为load事件。
However, I then need to load up a jQuery script as soon as the page has been loaded in. So, here is the question, how do I bind the script once the DOM has been updated? I have been using Ariel Fleser's listen plugin (http://flesler.blogspot.com/2007/10/jquerylisten.html) for picking up on events such as clicks which works a treat, but I can't see how this can be used to listen for a load event.
任何想法?我是pretty的词穷就这一个!
Any ideas? I'm pretty stumped on this one!!
推荐答案
有什么问题:
yourXMLHTTPRequest.onreadystatechange = function () {
if (this.readyState == 4) {
doJQueryStuff();
}
}
此外,什么是不使用jQuery中提供的AJAX功能的原因是什么?
Also, what's the reason for not using the AJAX functionality provided in jQuery?
顺便说一句,它看起来像插件,你刚才提到复制的 给出的功能生活()
和 委托()
带入的jQuery 1.4方法
As an aside, it looks like that plugin you mention just replicates the functionality given by the live()
and delegate()
methods brought into jQuery in 1.4
这篇关于使用jQuery监听正在使用jQuery.AJAX没有加载一个AJAX负荷的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!