title: Using CodeIgniter to get dropdown list data but Jquery returning undefined selected values on submit
body: <p>I am trying to serialize the form data and send it to the server using serializeJSON(). However, I am getting empty location array of a dropdown list by which the dropdown list data are retrieved from php using Codeigniter. Even though I have tried to console the selected value I am still getting undefined.</p>
  
  <p>This is how I create dynamic location select option input and I am adding dynamic index on top of that.</p>
  
  <pre><code>    $('.location-list').each(function(index){
          $(this).attr("name", "sessions["+ index + "][location]");
      });
  </code></pre>
  
  <p>This is how I show on view retrieving the data from php using CodeIgniter.</p>
  
  <pre><code>     &lt;div class="form-group"&gt;
          &lt;label&gt;Location&lt;/label&gt;&lt;br&gt;
          &lt;select class="form-control location-list" required)"
              &lt;!--optgroup?--&gt;
              &lt;option value="" selected disabled&gt;Please select&lt;/option&gt;
               &lt;?php       
                   foreach($locations as $row){
                       echo '&lt;option value="'.$row['name'].'"&gt;'.$row['name'].'&lt;/option&gt;';
                   }
               ?&gt;
          &lt;/select&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>This is how I call AJAX and pass serialized data to php.</p>
  
  <pre><code>            $.ajax({
                  type: "POST",
                  url: SITE_URL + '/create',
                  dataType: "json",
                  data: {
                      event : $('#eventForm').serializeJSON()
                  },
                  success: function (data) {
                      $('#eventForm')[0].reset();
                      window.location.href = SITE_URL + "pending";        
                  },
                  error: function (jqXHR, textStatus, errorThrow){
                  }
              }); 
  </code></pre>