Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/05/2016, 21:18
sarrhen
 
Fecha de Ingreso: mayo-2013
Ubicación: San Vicente
Mensajes: 127
Antigüedad: 11 años, 9 meses
Puntos: 1
Pasar variable de select por ajax

Como pasar una variable de una consulta select por medio de ajax y este es el codigo
aqui realizo la consulta
Código PHP:
Ver original
  1. <?php
  2. $q = ($_GET['q']);
  3. $con = mysqli_connect('localhost','','','');
  4. if (!$con) {
  5.     die('Could not connect: ' . mysqli_error($con));
  6. }
  7. mysqli_select_db($con,"informehipotecas");
  8. $sql="SELECT * FROM `informehipotecas` WHERE `Matricula` = '$q' AND `Estado` = 'DESEMBOLSO'";
  9. $result = mysqli_query($con,$sql);
  10. echo "<table>
  11. <tr>
  12. <th>id</th><th>Solicitante</th><th>Matricula</th><th>Monto</th>th>Propietario</th>
  13. <th>Departamento</th>
  14. <th>Institucion financiera</th>
  15. <th></th>
  16. </tr>";
  17. while($row = mysqli_fetch_array($result)) {
  18.     echo "<tr>";
  19.      $id=$row['id'];
  20.     echo "<td>" . $row['Solicitante'] . "</td>";
  21.     echo "<td>" . $row['Matricula'] . "</td>";
  22.     echo "<td>" . number_format($row['Monto'],2) . "</td>";
  23.     echo "<td>" . $row['Propietario'] . "</td>";
  24.     echo "<td>" . $row['Departamento'] . "</td>";
  25.     echo "<td>" . $row['GravamenesFinanciera'] . "</td>";
  26.     ?>
  27.        <td><a href="#"    id="id"  onClick="ajax_loader();">Actualizar</a></td>
  28. <?php
  29.     echo "</tr>";
  30. }
  31. echo "</table>";
  32. ?>
y este es el ajax que utilizo
Código HTML:
Ver original
  1.  function ajax_loader(x) {
  2.     req = $.ajax({
  3.         type: "GET",
  4.         url: "actualizarRegistroHipoteca.php?q=" + x,
  5.         datatype: "php",
  6.         success: function(data){
  7.             $('#data').html(data);
  8.         }
  9.     });
  10. }
  11.  <div id="data"></div>
  12. </body>
  13.    
  14.        </html>
Lo que necesito es pasar el valor del Id para despues hacer una actualizacion