title: jQuery form serialize data missing in CodeIgniter
body: <p>i have a form in my view page .....as i want to send data through jquery or ajax because i dont want to reload or refresh the page . i am sending data through jquery serialize.. but all the fields are not submitting through serialize..  here first dropdown which is “supplier” is going empty .. means jquery serialize is not capturing his value and i think there may be same situation for the rest of others .. why is that so ..here is my view page
  my form name and id is "form"</p>
  
  <pre><code>  &lt;?php  echo form_open('stockInController/addStockIn', $attributes);?&gt;
  
   &lt;!-- Supplier --&gt;
  
  
  Select a Supplier
  
   &lt;select name="sup_id" id="sup_id" class='cho'&gt;
    &lt;option id="y" value="0"&gt;--Select--&lt;/option&gt;
    &lt;?php foreach($records1 as $r) { ?&gt;
    &lt;option value="&lt;?=$r-&gt;sup_id?&gt;"&gt;
     &lt;?=$r-&gt;sup_name?&gt;
    &lt;/option&gt;
    &lt;?php } ?&gt;
    &lt;/select&gt;
  
  &lt;!-- end of Supplier --&gt;
  
  
  
       Date:&lt;?php echo form_input($date); ?&gt;
       Bill No: &lt;?php echo form_input($bill_no); ?&gt;
  
  
  
  
   &lt;table&gt;
    &lt;tr&gt;
     &lt;th&gt;Category:&lt;/th&gt;
     &lt;th&gt;Items:&lt;/th&gt;
     &lt;th&gt;Selling Price:&lt;/th&gt;
     &lt;th&gt;quantity:&lt;/th&gt;
     &lt;th&gt;total:&lt;/th&gt;
    &lt;/tr&gt;
  
          &lt;?php for ($i = 0; $i &lt; 5; $i++) { ?&gt;
    &lt;tr&gt;
        &lt;td&gt;
           &lt;?php echo form_dropdown ('cat_id'.$i,   $records2,'#',     "id='category_".$i."'onchange='getItems(this.value,".$i.")' ");?&gt;
     &lt;/td&gt;
  
  
  
  
         &lt;td&gt; &lt;?php echo form_dropdown('item_id'.$i, $records3, '#',    "id='items_".$i."'"); ?&gt;
  
     &lt;/td&gt;
  
  
  
  
  &lt;td&gt; &lt;input type="text" name = "price_&lt;?php echo $i ?&gt;" id = "price_&lt;?php echo $i  ?&gt;"    echo "$i"?&gt;)'&gt;
     &lt;/td&gt;
  
       &lt;td&gt;&lt;input type="text" name = "quantity_&lt;?php echo $i ?&gt;"
                             id = "quantity_&lt;?php echo $i ? &gt;"  echo "$i"?&gt;)'&gt;
     &lt;/td&gt;
  
     &lt;td&gt;&lt;input type="text"name = "total_&lt;?php echo $i ?&gt;" id = "total_&lt;?php echo $i ?&gt;"&gt;
     &lt;/td&gt;
    &lt;/tr&gt;
  
  
    &lt;?php }?&gt;
  
    &lt;tr&gt;
  
        &lt;td&gt;
      &lt;?php echo form_button($button); ?&gt;
      &lt;?php form_close();?&gt;
     &lt;/td&gt;&lt;/tr&gt;
  </code></pre>
  
  <p>here is my jquery function</p>
  
  <pre><code>     $('#btn').click(function(event) {
      form = $("#form").serialize();
  
    $.ajax({
      type: "POST",
      url: "&lt;?php  echo site_url('stockInController/addStockIn'); ?
      data: form,
  
      success: function(data){
     alert("true");
  
      }
  
    });
    event.preventDefault();
    return false;
  
  }); 
  </code></pre>