title: Passing array and other data through ajax
body: <p>This is my javascript function....
  But my php controller getting all values but not the array not sure why ? Need help.....
  Thanks in advance :)</p>
  
  <pre><code>function submitForm(){
      var id = $('#id').val(); 
      var supplier_id = $('#supplier_id').val();
      var description = $('#description').val();
      var numofpro = $('#numofpro').val();
  
      var product_id = new Array();
      for(var i=0;i&lt;numofpro;i++){
          product_id[i] = $('#product_id'+(i+1)).val();               
      }
      var payment_mode = $('#payment_mode').val();
      //description = description.replace(new RegExp('\r?\n','g'), '&lt;br /&gt;');     
      $.ajax({
              url: "&lt;?= base_url(); ?&gt;edit/save_purchase", //The url where the server req would we made.
              data: "id="+id+"&amp;supplier_id="+supplier_id+"&amp;description="+description+"&amp;product_id="+product_id+"&amp;payment_mode="+payment_mode,
              dataType: "html", //Return data type (what we expect).
              beforeSend:function(){
                  //alert("asds");
              },
              success: function(data) {
                  //alert("Edited");
                  alert(data);
  
              }
          });
  }
  </code></pre>