Ver Mensaje Individual
  #13 (permalink)  
Antiguo 10/05/2015, 18:00
pips
 
Fecha de Ingreso: octubre-2011
Mensajes: 104
Antigüedad: 12 años, 6 meses
Puntos: 1
Respuesta: pasar varias varibles autocomplete

Bueno, siguiendo tu ejemplo y resumiendo

Código PHP:
Ver original
  1. <!DOCTYPE html>
  2. <html lang = "es">
  3.     <head>
  4.         <meta charset = "utf-8" />
  5.         <title>Buscador</title>
  6.         <link rel = "stylesheet" type = "text/css" href = "jquery-ui-css.css" />
  7.         <link rel = "stylesheet" type = "text/css" href = "style.css">
  8.     </head>
  9.     <body>
  10.         <section id = "main">
  11.          <form name="form" action="productsearching.php" method="POST">
  12.             <label for = "buscar">Buscar:</label>
  13.             <input type = "text" name = "buscar" id = "buscar" placeholder = "Ingresa el dato a buscar" autofocus />
  14.             <input type = "hidden" name = "" id = "dato"/>
  15.             <script type = "text/javascript">
  16.              document.getElementById('dato').value;
  17.             </script>
  18.           </form>
  19.         </section>
  20.         <section id = "response">
  21.             <img />
  22.             <div id = "datos">
  23.                 <header>
  24.                     <h1></h1>
  25.                 </header>
  26.  
  27.                 <p>
  28.                     <label class = "ref">Nombre</label>
  29.                     <label class = "dato"></label>
  30.                 </p>
  31.  
  32.             </div>
  33.         </section>
  34.         <script type = "text/javascript" src = "jquery.js"></script>
  35.         <script type = "text/javascript" src = "jquery-ui.js"></script>
  36.         <script type = "text/javascript">
  37.         $("#buscar").keyup(function(e){
  38.     var tecla = e.keyCode || e.which;
  39.     if (tecla != 13)
  40.         if ($("#response").css("display") != "none")
  41.             $("#response").slideUp();
  42.             }).autocomplete({
  43.                 minLength: 1,
  44.                 source: "buscar.php",
  45.                 select: function (event, object){
  46.                     $("#response h1").html(object.item.value);
  47.                     $(".dato").eq(0).html(object.item.nombre);
  48.                     $("#response").slideDown();
  49.                 }
  50.             })
  51.        
  52.         </script>
  53.     </body>
  54. </html>

Cómo paso los objetos html(object.item.value) y html(object.item.nombre) a productsearching.php

Código PHP:

$value 
$_REQUEST['value'];

$nombre $_REQUEST['nombre']; 
Ó cómo creo una variable en php de html(object.item.nombre) ?

He intentado con

<script type="text/javascript">
document.getElementById('dato').value;
</script>
pero no hay manera. gracias y saludos