admin管理员组文章数量:1332881
In a script like the following, would the load
functions be called in asynchronously or one after another?
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$("#TheLink").click(){
$("#PlaceToUpdate1").load("/Controller/Method/View1");
$("#PlaceToUpdat2").load("/Controller/Method/View2");
}
});
});
</script>
In a script like the following, would the load
functions be called in asynchronously or one after another?
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$("#TheLink").click(){
$("#PlaceToUpdate1").load("/Controller/Method/View1");
$("#PlaceToUpdat2").load("/Controller/Method/View2");
}
});
});
</script>
Share
Improve this question
edited Oct 1, 2015 at 18:13
Francisco Noriega
asked Jan 14, 2010 at 4:52
Francisco NoriegaFrancisco Noriega
14.6k11 gold badges51 silver badges72 bronze badges
2 Answers
Reset to default 7Asynchronously, by default. If you need them to be one-after-the-other, you can do a few things:
- Place the second in the callback of the first.
- Set
$.ajax({async:false})
- You could possibly even set these up in a queue.
The cleanest way is probably option 2.
Yes, the full call for load is:
load( url, [data], [callback] )
the third optional parameter is a callback method that will be called when the asynchronous load method pletes.
本文标签: javascriptWould 2 consecutive load calls in jquery execute asyncStack Overflow
版权声明:本文标题:javascript - Would 2 consecutive .load calls in jquery execute async? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742306735a2450064.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论