title: Two dropdown with one onchange
body: <p>Hi what I'm trying to do is I have 2 dropdown. I want that the ajax will only work if the two dropdown has value selected. And how do I pass the datas of the two?
  Here is my code right now</p>
  
  <p><strong>SCRIPT</strong></p>
  
  <pre><code>&lt;script&gt;
  function getState(val) {
      $.ajax({
      type: "POST",
      url: "get_state.php",
      data:'country_id='+val,
      success: function(data){
          $("#state-list").val(data);
      }
      });
  }
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>INDEX</strong></p>
  
  <pre><code>&lt;label&gt;Group:&lt;/label&gt;&lt;br/&gt;
  &lt;select name="country" id="country-list" class="demoInputBox" onChange="getState(this.value);"&gt;
  &lt;option value=""&gt;Select Group&lt;/option&gt;
  &lt;?php
  while($row = mysql_fetch_array($results)) {
  ?&gt;
  &lt;option value="&lt;?php echo $row["g_id"]; ?&gt;"&gt;&lt;?php echo $row["g_name"]; ?&gt;    &lt;/option&gt;
  &lt;?php
  }
  ?&gt;
  &lt;/select&gt;
  &lt;label&gt;Division:&lt;/label&gt;&lt;br/&gt;
  &lt;select name="division" id="div-list" class="demoInputBox"  onChange="getState(this.value);"&gt;
  &lt;option value=""&gt;Select Division&lt;/option&gt;
  &lt;?php
  while($row = mysql_fetch_array($results2)) {
  ?&gt;
  &lt;option value="&lt;?php echo $row["d_id"]; ?&gt;"&gt;&lt;?php echo $row["div_name"]; ?&gt;    &lt;/option&gt;
  &lt;?php
  }
  ?&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p><strong>getstate.php</strong></p>
  
  <pre><code>&lt;?php
  include("dbcon2.php");
  if(!empty($_POST["country_id"])) {
  $query ="SELECT * FROM personnel_gdd WHERE pg_group = '" .    $_POST["country_id"] . "' ";
  $results = mysql_query($query) or die(mysql_error());
  ?&gt;
  
  &lt;?php
  $row = mysql_num_rows($results)
  ?&gt;
  &lt;?php echo $row; ?&gt;
  </code></pre>
  
  
  
  <p>PS: I know that mysql is deprecated. I'll change it as soon as this problem is fixed. Thanks!</p>