title: Can't set a variable in javascript while using autocomplete
body: <p>This is my current code:</p>
  
  <pre><code>var areaid;
  
  $( "#FindCentre" ).autocomplete({
      //Doesn't give the right value here.
      source: "databasescripts/findcentre.php?AreaID=" + areaid,
      minLength: 2,
      select: function( event, ui ) {
    },
   html: true,
  });
  
  $( "#FindArea" ).autocomplete({
      source: "databasescripts/findarea.php",
      minLength: 2,
      select: function( event, ui ) {
      areaid = ui.item.id;
      alert(areaid);
      //Alerts the correct value here.
    },
   html: true,
  });
  </code></pre>
  
  <p>When users type into FindArea it alerts the correct value, however when they then type into FindCentre it will always come back as being undefined. I've tried reading the ID from FindArea in FindCentre but I can't seem to do that either.</p>
  
  <p>Does anyone have any suggestions?</p>