Ayuda concatenando variables en la parte del js(vinculo php-js)
Publicado por sebastian (14 intervenciones) el 23/10/2019 16:43:56
num es una avriable que viene de antes, al igual que cuenta, la cosa es que nose concatenar bien la parte del javascript, ruego por su ayuda.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
for($x='1'; $x<=$num; $x++){
echo" <tr>";
echo"<td>";
echo" <select id=proyecto$x name=proyecto$x >";
$resultados = mysqli_query($conexion,"SELECT * FROM proyecto");
while($row = mysqli_fetch_array($resultados)){
$nombre= $row['Numero_proyecto'];
$id= $row['id_proyecto'];
echo"<option value=$id.$x>$nombre</option>";
}
echo"</select>";
echo"</td>";
echo"<td>";
echo" <div id=selecta$x></div>";
echo"</td>";
?>
<script type ="text/javascript">
var x = "<?php echo $x;?>";
$(document).ready(function(){
recargarLista+x();
$(#proyecto+x).change(function(){
recargarLista+x()
})
})
</script>
<script type ="text/javascript">
function recargarLista+x(){
$.ajax({
type:POST,
url:actt.php,
data:proyecto+x= +$(#proyecto+x).val(),
success:function(r){
$(#selecta+x).html(r)
}
})
}
</script>
<td>
<input type=text name=comentario[]>
</td>
<?php
for($v='1'; $v<=$cuenta; $v++){
echo"<td>";
echo"<input type= text name=horas[] id=horas$v.$x />";
echo"</td>";
}
echo"<td>";
echo" <input type= text name=total id= total$x readonly=readonly /> ";
echo"</td>";
echo" </tr>";
}
?>
</table>
</form>
</body>
</html>
Valora esta pregunta


0