title: How to set a selected option using ajax?
body: <p>I am new to jquery and ajax. I am trying to set a selected option in my dropdown using my ajax code below: </p>
  
  <pre><code>$.ajax({
          type: "POST",
          url: "sample.php",
          cache: "false",
          dataType: "json",
          success: function(data) {
            //data.month = 03
            $('#birth_month option[value="data.month"]').prop('selected', true);
          }
    });
  </code></pre>
  
  <p>This is my select html code:</p>
  
  <pre><code>&lt;select id="birth_month" name="birth_month"&gt;
  &lt;option value="" disabled selected&gt;Month&lt;/option&gt;
  &lt;option value="01"&gt;January&lt;/option&gt;
  &lt;option value="02"&gt;February&lt;/option&gt;
  &lt;option value="03"&gt;March&lt;/option&gt;
  &lt;option value="04"&gt;April&lt;/option&gt;
  &lt;option value="05"&gt;May&lt;/option&gt;
  &lt;option value="06"&gt;June&lt;/option&gt;
  &lt;option value="07"&gt;July&lt;/option&gt;
  &lt;option value="08"&gt;August&lt;/option&gt;
  &lt;option value="09"&gt;September&lt;/option&gt;
  &lt;option value="10"&gt;October&lt;/option&gt;
  &lt;option value="11"&gt;November&lt;/option&gt;
  &lt;option value="12"&gt;December&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>And for some reason, it doesn't work. What am I doing wrong? </p>
  
  <p>Thank you in advance for the suggestions.</p>