Good evening,
Personally, my 'l_os' page lists and changes all the items on another page properly. Only I'm changing all the pages so I can view and change through a single page to index.Ai that enters ajax in my index I present the page that lists all the items that when clicking on the change action ajax calls the page that changes and displays the values in the fields. The problem is when I click on change the value this goes wrong for ajax presenting another value in the fields is only the first line that I can click the others nothing happens.
Since I have placed the parameters in ajax to be able to retrieve the values on the page that changes, it is not working properly, I believe that ajax is only taking one line from my independent list in which row of the table I click to change. / p>
If anyone could help me, I would appreciate it.
Page 'l_os'
<!DOCTYPE html>
<html lang="pt-br">
<head>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Cadastro Funcionario</title>
<!-- Bootstrap -->
<link href="style/css/bootstrap.min.css" rel="stylesheet">
<link type="text/css" href="style/css/style.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script><scriptsrc="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container-fluid">
<div class="page-header">
<h3>Consulta Ordem de Serviço</h3>
</div>
<div class="">
<a href="#" id="cadastro_os" class="btn btn-default btn-cadastrar-btn">Incluir OS</a>
</div>
<table style="width: 450px" class="table table-striped table-bordered table-hover table-condensed table-responsive " >
<thead >
<th> Prótocolo</th>
<th> Funcionario</th>
<th> Cliente</th>
<th> Email</th>
<th> Telefone</th>
<th> Celular</th>
<th> CPF</th>
<th> Cidade</th>
<th> Endereço</th>
<th> Serviço</th>
<th> Situacao</th>
<th> Data_OS</th>
<th colspan="2"> Ações</th>
</thead>
<tbody >
<?php
$CODAO = new OsDAO();
$query = $CODAO->listar_os();
foreach($query as $reg):
?>
<tr class="success largura">
<td> <?=$reg["id_protocolo"] ?></td>
<td> <?=$reg["nome_funcionario"] ?></td>
<td> <?=$reg["nome"] ?></td>
<td> <?=$reg["email"] ?></td>
<td> <?=$reg["telefone"] ?></td>
<td> <?=$reg["telefone_celular"] ?></td>
<td> <?=$reg["cpf"] ?></td>
<td> <?=$reg["cidade"] ?></td>
<td > <?=$reg["endereco"] ?></td>
<td > <?=$reg["nome_servico"] ?></td>
<td > <?=$reg["situacao"] ?></td>
<td > <?=date("d/m/Y H:i:s", strtotime($reg["data_os"])); ?></td>
<td >
<center>
//id para o ajax ativar a função clicar
<a id="alterar_os" href="#" class="btn btn-default">Alterar</a>
</center>
</td>
</tr>
</tbody>
<script type="text/javascript">
$(document).ready(function(){
$('#cadastro_os').click(function(){//essa parte do ajax funciona perfeito para incluir
$( "#cliente1" ).load( "os/c_os.php" );
});
$('#alterar_os').click(function(){
$( "#cliente1" ).load( "os/a_os.php?IDCLI=<?=$reg["id_cliente"];?>&IDFUN=<?=$reg["id_funcionario"];?>&IDSER=<?=$reg["id_servico"];?>&IDOS=<?=$reg["id_protocolo"];?>" );
});
});
</script>
<?php
endforeach;
?>
</table>
</div>
</body>
<script src="style/js/bootstrap.min.js"></script>
</body>
</html>