Update data of a form according to a record of an html table

2

The problem is that when you update the form data, you do it correctly, but the main menu and the navigation bar stops working. I have it like this ...

<tbody >
 <?php
  while($fila=sqlsrv_fetch_array($consultaVendedores)){
   $numVende=$fila['no_vende'];
   $nom=$fila['nombre'];
   $rfc=$fila['rfc'];
 ?>
 <tr id="fila" onclick="alerta(<?php echo $numVende;?>);"  >
  <th id="no_vende" ><?php echo $numVende; ?></th>
  <th id="nombre"><?php echo $nom; ?></th>
  <th id="rfc"><?php echo $rfc; ?></th>
 </tr>       
 <?php 
  }
 ?>      
</tbody>

This is the fragment of the table in which I send a function called alerta , and I send the seller number.

function alerta(id){
 $("#info").load('datosVende.php?id='+id);
}

This is the function in which it sends to load the page datosVende.php in which I only update the div with id=info , making the query, but now in this way ...

$NumeroVende= $_GET['id'];
 <?php
  /* -----PRIMER REGISTRO----- */
  $consultaPrimerVende="SELECT * FROM aavende where no_vende=$NumeroVende";
  $queryPrimerVende=sqlsrv_query($conn,$consultaPrimerVende);
  $fila=sqlsrv_fetch_array($queryPrimerVende);
  $no_vende=$fila['no_vende'];
  $nombre=$fila['nombre'];
  $rfc=$fila['rfc']; 
  $direccion1=$fila['direccion1'];
  $direccion2=$fila['direccion2'];
  $ciudad=$fila['ciudad'];    
  $estado=$fila['estado'];    
  $tel1=$fila['telefono1'];
  $tel2=$fila['telefono2'];
 ?>

Everything else I leave as it is in catalogoVendedores.php , but I do not work the main menu and the navigation bar ... I already tried putting the code of the main menu and the navigation bar in the datosVende.php , but even then it does not work.

What is marked with blue boxes is what does not work when updating the seller's data.

    
asked by Damian 07.10.2016 в 23:45
source

1 answer

1

three things:

1) If you are developing with firefox, I recommend installing firebug, it is very useful to track and shows you the errors in the console, in this case, if any script generates an error, firebug will show it to you

2) If you put new code (like the one you were asked for), try to edit your original post and add it below, indicating this

3) I get the impression that it may not be a javascript error, I mean, you have your page loaded, and you update a section of it, which your JQuery no longer has the "reference" to say it a simple way, normally when you have dynamic sections in which you have to "click" or some action on it, that event is added in a on of JQuery

$( "#id-del-elemento" ).on( "click", function() {
  //Accion a ejecutarse
});

This allows any section that is loaded dynamically, to be recognized by JQuery (try to explain it as simple as possible)

Reference: link

In summary, check point 1, if it is not a javascript error, then it may be point 3.

Greetings

EDIT:

The error was finally due to the fact that there was a main page in which everything was loaded, but when entering a section, for example, Catalog of Sellers, and it was clicked on a record of the grid, below it I executed an ajax that loaded the page again and included it, which generated that the same JS were loaded N times, in short, it had so many JS running that the navigator got dizzy. The solution was to centralize and clean the dynamic sections to load only the forms and / or data, and all the CSS and JS remained on the master page or main page, so, they are only loaded once and all the dynamic sections occupy them.

    
answered by 13.10.2016 в 06:56