【发布时间】:2010-11-29 13:33:08
【问题描述】:
请帮我为我的情况创建正确的事件。我相信有 真正的方法,无需任何计数器(如:How to know when all ajax calls are complete)
HTML:
<ul id="links">
<li><a href="1.html">What is Yoda's first name?</a></li>
<li><a href="2.html">Why does Padme die?</a></li>
<li><a href="3.html">Who is Darth Rage?</a></li>
</ul>
<div id="content"></div>
jQuery:
$('#links a').each(function (index, el) {
url = $(el).attr('href');
$('<div class="article" />').appendTo('#content')
.load(url, function(){
filterOneArticle(this);
});
});
// I want this function run after all articles will be loaded and filtered
$.bind('yepAllArticlesHaveBeenLoaded', filterAllArticles);
filterAllArticles = function() {};
filterOneArticle = function(el) {};
【问题讨论】:
标签: javascript jquery ajax javascript-events event-handling