如何使用jQuery从页面数组加载 - 为了 [英] how to use jquery to load from array of pages - in order
问题描述
我抓了一堆从一个网页链接,然后从这些网页上有具体的内容元素拉动。在code我刚创作的作品,并做到了这一点。
的问题是,因为请求是异步的,元件被不按顺序加载了。我尝试添加一个延迟,但没有奏效。
我是否需要使用.load的阿贾克斯呢?如果是的话,会是什么这个循环追加看起来像阿贾克斯命令?你仍然可以使用的URL的选择?或者是有与.load以达致这一种有效的方式?
先谢谢了。
函数runthis(){VAR链接= $(#文章滑带一)。图(函数(){
返回this.href;
})。得到();$。每个(链接功能(I,L){ $(< DIV>中)。负载(L +.gl_left功能(){
$(。gl_left)追加($(本).find()HTML()gl_left。);
}); });}
这也许:的http://插件.jquery.com /项目/ ajaxqueue
I'm grabbing a bunch of links from a page and then pulling in a specific content element from those pages. The code I just created works and does just that.
The problem is because the requests are asynchronous, the elements are not loading up in order. I tried adding a delay but that didn't work.
Do I need to be using .ajax instead of .load? If so, what would this looped append look like with .ajax command? Can you still use a selector with the url? Or is there an effective way to acheive this with .load?
Thanks in advance.
function runthis() {
var links = $("#article-slide-belt a").map(function() {
return this.href;
}).get();
$.each( links, function(i, l){
$("<div>").load(l + " .gl_left", function() {
$(".gl_left").append($(this).find(".gl_left").html());
});
});
}
Perhaps this: http://plugins.jquery.com/project/ajaxqueue
这篇关于如何使用jQuery从页面数组加载 - 为了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!