Ver Mensaje Individual
  #5 (permalink)  
Antiguo 02/10/2012, 07:14
Avatar de satjaen
satjaen
 
Fecha de Ingreso: septiembre-2012
Ubicación: Jaén (Andalucía)
Mensajes: 893
Antigüedad: 11 años, 7 meses
Puntos: 10
Respuesta: Pasar variable a php

Gracias a los dos por contestar, pero si vas a Java vereis que es lo que me a contestado Dradi7.Salvo el php que es de mi cosecha.
De todas formas esta tarde pruebo y os cuento......

No me funciona con lo que me habeis corregido.

Código Javascript:
Ver original
  1. function filtrar()
  2. {  
  3.     $.ajax({
  4.         data: $("#frm_filtro").serialize()+ordenar,
  5.         type: "POST",
  6.         dataType: "json",
  7.         url: "ajax.php?action=listar",
  8.             success: function(data){
  9.     var html_user ='' ;
  10.     if(data.length > 0){
  11.         $.each(data, function(i,item){
  12.        
  13.        
  14.          
  15.  html_user += '<tr ondblclick="pulsar(this, ' +  String.fromCharCode(39) + item.num_usuario + String.fromCharCode(39)  + ');" >';
  16.  html_user += '<td ><input name="demo" type="radio"/></td>';
  17.  html_user += '<td >'+item.num_usuario+'</td>';
  18.  html_user += '<td>'+item.telefono+'</td>';
  19.  html_user += '<td>'+item.nombre+' '+item.apellidos+'</td>';
  20.  html_user += '<td>'+item.poblacion+'</td>';
  21.  html_user += '</tr>';
  22.            
  23.                                  
  24.         });                    
  25.     }
  26.     if(html_user == '') html_user = '<tr><td colspan="4" align="center">No se encontraron registros..</td></tr>';
  27.     $("#data tbody").html(html_user);
  28. }
  29.  
  30.            
  31.       });
  32. }
  33.  
  34. function createAjax(){
  35.    if (window.XMLHttpRequest)
  36.    {
  37.       xmlhttp=new XMLHttpRequest();
  38.    }
  39.    else
  40.    {
  41.       xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  42.    }
  43. }
  44.  
  45. function buscarAparatos()
  46. {
  47.     var num_usuario = 0;
  48.     var elements = document.getElementsByName('demo');
  49.    
  50.     for(var x=0;elements[x];x++){
  51.         if(elements[x].checked){
  52.             num_usuario = elements[x].value;
  53.             break;
  54.         }
  55.     }
  56.  
  57. createAjax();
  58.     xmlhttp.open("GET","listado_aparatos.php?ID=" + num_usuario,true);
  59.     xmlhttp.onreadystatechange=function()
  60.     {
  61.         if (xmlhttp.readyState==4 && xmlhttp.status==200)
  62.         {
  63.             document.getElementById("pestaña1").innerHTML=xmlhttp.responseText;
  64.         }
  65.     }
  66. }

Código PHP:
Ver original
  1. $num_usuario=$_GET['ID'];
  2. mysql_select_db($database_conexion, $conexion);
  3. $query_Recordset1 = "SELECT * FROM ap_usuarios where num_usuario=".$num_usuario.";";
  4. $Recordset1 = mysql_query($query_Recordset1, $conexion) or die(mysql_error());
  5. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  6. $totalRows_Recordset1 = mysql_num_rows($Recordset1);

Última edición por satjaen; 02/10/2012 a las 07:54