title: Change global variable inside JavaScript closure
body: <p>I'm trying to change the value of a variable in a closure:</p>
  
  <pre><code>var myVariable;
  $.ajax({
      //stuff....
      success:function(data) {
          myVariable = data;
      }
  });
  </code></pre>
  
  <p>This does not work because <code>myVariable</code> is not visible to the closure. How do I change this code so that the value of <code>myVariable</code> changes?</p>