problem with clone - jquery/php
I have a div that has inside a piece of php code
I need to replicate the div and the php, how i can do that?
clone method doesn't work obviously with php , only clone the div but without the php code.
<div id="wrap" style="margin: 80px;">
<p>
<label>Área profissional :</label> <select name="area" class="area">
<option selected="selected">Seleccione a Área</option>
<?php
$sql=mysql_query("select id_formation_area, area from formation_area");
while($row=mysql_fetch_array($sql)){
$area=$row['area'];
$id_area=$row['id_formation_area'];
echo '<option value='.$id_area.'>'.$area.'</option>';
}
?>
</select> <label>Profissão:</label> <select name="profissao"
class="profissao">
<option selected="selected">Seleccione开发者_如何学Python a profissão</option>
</select> <label>Gráfico:</label> <select name="estatistica"
class="estatistica">
<option selected="selected">Seleccione a estatistica</option>
</select> <span class="remove">Remove</span>
</p>
<p>
<span class="add">Add fields</span>
</p>
</div>
- You can't use Client side technology (without ajax support) to clone a server-side code
- It seems that your mysql query will not return different result if you query it again, which means (point 3)
- Since your PHP code is generating HTML output, cloning the output will be equivalent to "outputing the whole thing once again"!
If you want to clone the div#wrap
use:
$("#wrap").clone().insertAfter($("#wrap"));
精彩评论