title: In jQuery.post, how do I get value of variable outside function?
body: <p>I have the following function:</p>
  
  <pre><code>var id = "10";
  var type = "Type A";
  var img = "myimage.jpg";
  
  jQuery.post("my/path/somefile.php", { instance: 'getUrl', ID : id, type: type},
  function(data)
  { 
      jQuery('#logo').attr("src",data.url + img);
  },"json"); 
  </code></pre>
  
  <ol>
  <li>How can I get the value of <code>img</code> when I'm inside the function?</li>
  <li>How can I sett <code>img = new value</code> from inside the function?</li>
  </ol>
  
  <p><strong>UPDATE</strong></p>
  
  <p>This code does NOT give a new value to the variable:</p>
  
  <pre><code>    logoUrl = "noLogo.png";
  
      jQuery.post("my/path/somefile.php", { instance: 'getUrl', ownerID : "123", type: "brand"},
      function(logo)
      {
          logoUrl = logo.url + "logo/";
      },"json");      
  
      alert(logoUrl); // This outputs noLogo.png"
  </code></pre>