take the result from JS to CI
<p>i stuck with this one,, i want the the result from js to CI.. i want got string type data from js, and sendback it to CI.
this is my code:</p>

<pre><code>&lt;?php $i=0; foreach ($bahanx as $pin2){ ?&gt; &lt;script type="text/javascript"&gt;
      document.write("&lt;div class='input-group' style='width:175%'&gt;&lt;label class='input-group-addon' style='width:100px'&gt;&lt;input type='checkbox' name='bahan' aria-label='Checkbox for following text input' value="+&lt;?php echo $pin2-&gt;id_barang ?&gt;+" oninput='changeText(this,"+&lt;?php echo $i ?&gt;+");' &gt; &lt;?php echo $pin2-&gt;nama_barang;?&gt;&lt;/label&gt;&lt;input type='text' class='form-control' aria-label='Text input with checkbox' name='banyak_bahan' value='0' disabled/&gt;&lt;/div&gt;&lt;br/&gt;");
    &lt;/script&gt;
&lt;?php
$i++; } ?&gt;
</code></pre>

<p>and this:</p>

<pre><code>var item_box = document.getElementsByName('banyak_bahan');
var item_name = document.getElementsByName('bahan');
var tot;
function changeText(e,i){
  item_name[i].value = e.checked ? 1 : 0;
  item_box[i].disabled = !e.checked;
  var x=x+","+item_box[i];
  var y=y+","+item_name[i];
  //alert(x);
  document.getElementById('fff').innerHTML=x+"&lt;br/&gt;"+y;
}
</code></pre>

<p>id=fff</p>

<pre><code>&lt;div id='fff'&gt;&lt;/div&gt;
</code></pre>

<p>the result:</p>

<blockquote>
  <p>undefined,[object HTMLInputElement]
  undefined,[object HTMLInputElement]</p>
</blockquote>