Would 2 consecutive .load calls in jquery execute async?
javascript, jquery
Solution
Asynchronously, 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.
Problem
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> ```