栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

触发$ document.ready(因此执行了我无法修改的AJAX代码)

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

触发$ document.ready(因此执行了我无法修改的AJAX代码)

经过一些研究,我创造了一种使其工作的方法。

这是我的测试,表明它可以正常工作:http :
//www.antiyes.com/test/test2.php

这是相关代码:

<script>    // easy copy of an array    Array.prototype.copy = function() {        return [].concat(this);    };    // this function is added to jQuery, it allows access to the readylist    // it works for jQuery 1.3.2, it might break on future versions    $.getReadyList = function() {        if(this.readyList != null) this.myreadylist =  this.readyList.copy();   return this.myreadylist;    };    $(document).ready(function() {        alert("blah");    });</script><script>    // this should be added last so it gets all the ready event    $(document).ready(function() {        readylist = $.getReadyList();    });</script>

然后在体内我有:

<input type="button" onclick="$(readylist).each(function(){this();});" value="trigger ready" />

基本上,我所做的就是在jQuery中添加了一个函数,该函数在清除readyList之前将其复制出来,然后可供您使用。

看起来下面的代码不起作用:

function AjaxLoaded() {    $(document).trigger('ready');}

删除报价

document



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/368606.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号