Bueno, siguiendo tu ejemplo y resumiendo
Código PHP:
Ver original<!DOCTYPE html>
<html lang = "es">
<head>
<meta charset = "utf-8" />
<title>Buscador</title>
<link rel
= "stylesheet" type
= "text/css" href
= "jquery-ui-css.css" /> <link rel
= "stylesheet" type
= "text/css" href
= "style.css"> </head>
<body>
<section id = "main">
<form name="form" action="productsearching.php" method="POST">
<label for = "buscar">Buscar:</label>
<input type = "text" name = "buscar" id = "buscar" placeholder = "Ingresa el dato a buscar" autofocus />
<input type = "hidden" name = "" id = "dato"/>
<script type = "text/javascript">
document.getElementById('dato').value;
</script>
</form>
</section>
<section id = "response">
<img />
<div id = "datos">
<header>
<h1></h1>
</header>
<p>
<label class = "ref">Nombre</label>
<label class = "dato"></label>
</p>
</div>
</section>
<script type = "text/javascript" src = "jquery.js"></script>
<script type = "text/javascript" src = "jquery-ui.js"></script>
<script type = "text/javascript">
$("#buscar").keyup(function(e){
var tecla = e.keyCode || e.which;
if (tecla != 13)
if ($("#response").css("display") != "none")
$("#response").slideUp();
}).autocomplete({
minLength: 1,
source: "buscar.php",
select: function (event, object){
$("#response h1").html(object.item.value);
$(".dato").eq(0).html(object.item.nombre);
$("#response").slideDown();
}
})
</script>
</body>
</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