Call function with param from JavaScript
<p>I hope you can help me.</p>

<p>I'm trying to call a php function from javascript.</p>

<p>when I place a value in concatenation with a string does not work but if I put a fixed value without concatenate if I called the function correctly.</p>

<p>I leave the code I use.</p>

<p><strong>Function from my controller:</strong></p>

<pre><code>function size_make_dropdownlist($size_make_id)
{
    $output = "&lt;select id='size_make' name='size_make' style='width:100px;'&gt;";

    //$output .= $this-&gt;new_option('Seleccionar', '0', $size_make_id);

   // $query = $this-&gt;car_model-&gt;get_car_makes();

    $options = array('product_id' =&gt; id_clean($size_make_id));
    $Q = $this-&gt;db-&gt;getwhere('omc_product_sizes',$options);
    if ($Q-&gt;num_rows() &gt; 0){
    $query = $Q-&gt;row_array();   


    foreach ($query as $row)
    {
        $output .= "&lt;option value=".$row['product_id']."&gt;Talla ".$row['size']."&lt;/option&gt;";
    }
    }
    $output .= "&lt;/select'&gt;";

    return ($output);
}
</code></pre>

<p><strong>FUNCTION JAVASCRIPT</strong></p>

<pre><code>function sizes(product){
var phpcodeis="&lt;?php $size_make_dropdownlist=$this-&gt;MProducts-&gt;size_make_dropdownlist("+product+"); echo $size_make_dropdownlist; ?&gt;";

//$size_make_dropdownlist=$this-&gt;MProducts-&gt;size_make_dropdownlist("+product+"); echo $size_make_dropdownlist; ?&gt;"; //When use this line work perfectly but i need the another one

document.getElementById("php_code_size").innerHTML=phpcodeis;
alert(product);
}
</code></pre>

<p><strong>CODE HTML</strong></p>

<pre><code>&lt;a href="#"
   style="display:block; color:#333; font-family:Tahoma; font-size:12px;"
   onclick="sizes(1); return false;"&gt; Sizes 1 &lt;/a&gt;
&lt;a href="#"
   style="display:block; color:#333; font-family:Tahoma; font-size:12px;"
   onclick="sizes(2); return false;"&gt; Sizes 2 &lt;/a&gt;
&lt;span id="php_code_size"&gt; &lt;/span&gt;
</code></pre>

<p>or another way to do this?</p>

<p>I would understand a little more hope that this help me be a little easier.</p>

<p>Thanks in advance</p>
