title: How to disable a submit button when AJAX request is in progress and enable it after receiving success AJAX response?
body: <p>I've following HTML code:</p>
  
  <pre><code>&lt;form action="view_rebate_master.php" method="post"&gt;
    &lt;div class="form-group"&gt;
      &lt;label for="company_name" class="col-lg-12"&gt;Manufacturer&lt;/label&gt;
      &lt;div class="col-lg-12"&gt;
        &lt;select id="company_id" class="form-control" onchange="GetProductByManufacturerID(this.value)" name="company_id"&gt;
          &lt;option selected="selected" value=""&gt;All Manufacturers&lt;/option&gt;
          &lt;option value="40"&gt;Test&lt;/option&gt;
          &lt;option value="42"&gt;RK&lt;/option&gt;
          &lt;option value="49"&gt;Blue Nun&lt;/option&gt;
          &lt;option value="58"&gt;Unique Imports&lt;/option&gt;
          &lt;option value="59"&gt;Pernod Ricard&lt;/option&gt;
          &lt;option value="77"&gt;Smoking Loon&lt;/option&gt;
          &lt;option value="78"&gt;Beringer&lt;/option&gt;
        &lt;/select&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="col-xs-4"&gt;
      &lt;div class="form-group"&gt;
        &lt;label for="product_id" class="col-lg-12"&gt;Product Name&lt;/label&gt;
        &lt;div class="col-lg-12"&gt;
          &lt;select id="product_id" class="form-control" name="product_id"&gt;
            &lt;option selected="selected" value=""&gt;All Products&lt;/option&gt;
            &lt;option value="12"&gt;Riesling&lt;/option&gt;
            &lt;option value="24"&gt;Superio Vodka&lt;/option&gt;
            &lt;option value="32"&gt;Heineken&lt;/option&gt;
            &lt;option value="33"&gt;Strong Bow&lt;/option&gt;
            &lt;option value="34"&gt;Grocery&lt;/option&gt;
            &lt;option value="35"&gt;Ruler&lt;/option&gt;
            &lt;option value="36"&gt;Glass&lt;/option&gt;
            &lt;option value="37"&gt;Brown Bread&lt;/option&gt;
            &lt;option value="38"&gt;White Bread&lt;/option&gt;
            &lt;option value="55"&gt;Cabernet Sauvignon&lt;/option&gt;
          &lt;/select&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="col-lg-12"&gt;   
      &lt;div class="col-xs-5"&gt;
        &lt;div class="form-group"&gt;
        &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;button type="submit" class="btn btn-primary" name="search" id="search"&gt;Search Rebates&lt;/button&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>The AJAX jQuery code is as follows:</p>
  
  <pre><code>function GetProductByManufacturerID(value) { 
    $.ajax({
      type: "POST",
      url: "add_rebate_by_quat_volume.php",
      data: { manufacturer_id: value, op:"" },
      beforeSend: function() { 
        $("#product_id").html('&lt;option&gt; Loading ...&lt;/option&gt;');
      },
      success:function(data){ 
        $("#product_id").html('');
        $("#product_id").append(data);
      }
    });
  }
  </code></pre>
  
  <p>I want to make the submit button disable when the AJAX function call is made by changing the value of select control(select control for Manufacturer selection) and it should be disabled till the AJAX success response is received. When AJAX success response will receive the user should be able to click on the submit button. How to achieve this? Thanks in advance.</p>