title: Function in Jquery passing form element's ID as parameter
body: <p>I'm trying to make a function in Jquery that will take the ID of form SELECT element's ID where a dynamically created option should be displayed. But, i have to repeat this work for other form instances as well. i have created the following code, but it did not work.</p>
  
  <h2>JQuery Script</h2>
  
  
  
  <pre class="lang-js prettyprint-override"><code>function getOffice(ID){
      $.post('dynamicOffice.php',{operator:$(this).val()},function(output){
      $('ID').html(output);
      });
          $('ID').removeAttr('disabled');
  }
  </code></pre>
  
  <h2>Main HTML File</h2>
  
         
  
  <pre class="lang-html prettyprint-override"><code>&lt;select id="senderOperator" name="senderOperator" tabindex="1" onchange=getOffice(sender)&gt;
      &lt;option value=""&gt;&lt;--SELECT an Operator --&gt;&lt;/option&gt;                 
          &lt;?php getOption($operator,Operator) ?&gt;
  &lt;/select&gt;
  
  &lt;select id="sender" name="sender" tabindex="1" disabled="disabled"&gt;
      &lt;option value=""&gt;&lt;--SELECT the Operator First --&gt;&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <h2>dynamicOffice.php</h2>
  
  
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  include('generateOption.php');
      $country=$_POST['operator'];
      $officeSql="SELECT * FROM myoffice WHERE Operator='$country'";
      getOption($officeSql,Name);
  ?&gt;
  </code></pre>
  
  <h2>generateFormElement.php</h2>
  
          
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  include("include/dbConnect.php");       
  
  function getOption($rsSql,$colName){
  
      $sResult=mysql_query($rsSql) or die("Could Not Fetch Records");
  
      while ($s_Office = mysql_fetch_array($sResult))
      {
          echo("&lt;option value='".$s_Office["$colName"]."'&gt;".$s_Office["$colName"]."&lt;/option&gt;");
      }
  }
  ?&gt;
  </code></pre>