Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/06/2012, 14:47
warelo17
 
Fecha de Ingreso: mayo-2012
Mensajes: 28
Antigüedad: 12 años
Puntos: 0
imprimir valores desde un php a un html

tengo una duda tengo un codigo html que lo tengo con un ajax, en el php tengo unas variables que quisiera pasárselas al html mi pregunta es la siguiente puedo capurar esas variables en el success del ajax o ocuparlas en el html?
aqui esta el ajax, por ejemplo ponerlo dentro de un textfield.


Código PHP:
Ver original
  1. <html>
  2.     <head>
  3.         <script type="text/javascript" src="../plugins/jquery-1.7.2.js" ></script>
  4.     </head>
  5.  
  6.     <body>
  7.         <br>
  8.         <label>Nombre de Usuario:</label>
  9.         <input type="text" id="texto" />
  10.         <input  type= "button" value = "Consultar" id = "boton" />
  11.         <br></br>
  12.         <br></br>
  13.         <br></br>
  14.         <label>DATOS USUARIO</label>
  15.         <div id = "datos_usu" >
  16.             <br></br>
  17.             <br></br>
  18.             <br></br>
  19.         </div>
  20.         <label>PERMISOS QUE POSEE</label>
  21.         <div id ="permiso">
  22.            
  23.          
  24.    
  25.          
  26.         <br></br>
  27.         </div>
  28.        
  29.         <script>
  30.             $(document).ready(function(e) {
  31.                 $('#boton').click(function(){
  32.                     var mensaje = $('#texto').val();
  33.                    
  34.                     $.ajax({
  35.                         type     : "GET",
  36.                         url      : "admin_urgencia/ajax_admin_urg_add.php",
  37.                         data     : "mensaje="+mensaje,
  38.                         cache    : false,
  39.                         success  : function(datos){
  40.                                     alert(mensaje);
  41.                                     if (mensaje.length !== 0) {
  42.                                        
  43.                                         var hola = $_GET['nombres'] ;
  44.                                         alert(hola);
  45.                                     }
  46.                                     else{
  47.                                         alert("Necesita llenar el campo Nombre de usuario");
  48.                                        
  49.                                        
  50.                                        
  51.                                     }
  52.                                    
  53.                                    
  54.                                
  55.                         }
  56.                     });
  57.                 });
  58.             });
  59.         </script>
  60.     </body>
  61. </html>

y aqui esta el php q necesito mandarle las variables

Código PHP:
Ver original
  1. <?php
  2. $hola = $_GET['mensaje'];
  3. $bus = $usu_urg -> buscar($hola);
  4. $bus2 = $dato_usu -> setUsuario($bus['out_usu_id']);
  5. $id = $dato_usu -> getFunID();
  6. $bus3 = $funcio -> setFuncionario($id);
  7. $nombres = $funcio -> getNombres();
  8.  
  9.  
  10. ?>


por ejemplo la variable nombres necesito rescatarla y enviarla al html