title: jquery - wait till function finishes
body: <p>If I understand jquery and javqascript correctly, it is asyncronous. What I fail to understand is if it is asynchronus only the ajax part, the load and get... or everything in general.</p>
  
  <p>For example if I need to append a list menu in form and have:</p>
  
  <pre><code>$('#id').append("&lt;option value='1'&gt;1&lt;/option&gt;") - etc., in this demo the &lt;select id="category&gt; is missing
  </code></pre>
  
  <p>now I'd like:</p>
  
  <pre><code>$('#category option[value="1"]').attr('selected', 'selected');
  </code></pre>
  
  <p>Of course I'd like this to select the value 1 AFTER the menu is appened, not before as it doesn't exist.</p>
  
  <p>I am wondering if the script waiting till append finishes and it is fase to write both lines one after another or is there a need here to put some callback function on the first one so that the second line executes after the append is done?</p>
  
  <p>It works on my browser, but I have a fast computer, I am worried on some slow one it would try to select before the select is even appended if it is asynchronius.</p>
  
  <p>Or is only ajax calls asynchronius? This is something obvious and beginner like, but there are no good keywords I could find to pinpoint this basic thing so I am asking here.</p>