title: Javascript variable value not refreshing in alert box
body: <p>Please help me to fix this. The issue is when i select Bangalore and choose any name from 2nd level select and click on button than result is fine, now without refreshing page i choose Hyderabad and a value from 2nd level select and click on button it is still showing value from Bangalore's 2nd level value in alert.</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>&lt;div class="Banglore"&gt;
      &lt;select class="second-level-select" id="start_1"&gt;
          &lt;option value=""&gt;-Select Your Area-&lt;/option&gt;
          &lt;option value="Mettuguda"&gt;Mettuguda&lt;/option&gt;
          &lt;option value="Lingampally"&gt;Lingampally&lt;/option&gt;
      &lt;/select&gt;
  &lt;/div&gt;
  &lt;div class="Hydrabad" &gt;
      &lt;select class="second-level-select" id="start_2"&gt;
          &lt;option value=""&gt;-Select Your Area-&lt;/option&gt;
          &lt;option value="A F Hospital"&gt;A F Hospital&lt;/option&gt;
          &lt;option value="Abbur"&gt;Abbur&lt;/option&gt;
      &lt;/select&gt;
  </code></pre>
  
  <p>
      </p>
  
  <p><strong>Script:</strong></p>
  
  <pre><code>function startAjax() {
      var a1 = $("#start_1").val();
      var a2 = $("#start_2").val();
      if(a1 != ''){
          var b = a1;
      }else{
          var b = a2;
      }
  
      alert(b);
  
  }
  
  $(document).ready(function() {
  
  $('#Rank').bind('change', function() {
  
      var elements = $('div.container').children().hide(); // hide all the elements
  
      var value = $(this).val();
  
      if (value.length) { // if somethings' selected
  
          elements.filter('.' + value).show(); // show the ones we want
      }
  
  }).trigger('change');
  });
  </code></pre>
  
  <p>for more detail: <a href="http://jsfiddle.net/72pbbsfy/2/" rel="nofollow">http://jsfiddle.net/72pbbsfy/2/</a>
  Thanks for help!</p>