Ver Mensaje Individual
  #4 (permalink)  
Antiguo 08/04/2014, 14:28
marcusaurelio
 
Fecha de Ingreso: enero-2007
Mensajes: 285
Antigüedad: 17 años, 3 meses
Puntos: 21
Respuesta: NUEVO en AJAX

y en jquery? sera mas o menos asi


index.php
Código:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Documento sin título</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
</head>

<body>
<p>
  <label for="textfield">en blur pasa datos</label>
  <input type="text" name="textfield" id="campo">
  <label for="textfield"><br>
    <br>
  en keyup pasa datos</label>
  <input type="text" name="textfield" id="campo1">
</p>
<div id="contenido" style="border:solid 1px #FF0000; width:200px; height:200px;"></div>

<script>
$(function(){
	
	
	$("#campo").blur(function(){
		
		$.ajax({
			  type: "POST",
			  url: "salida.php",
			  data: { nombre: $("#campo").val() }
			}).done(function( msg ) {
				$("#contenido").html(msg);
			  });
		
		})
		
		$("#campo1").keyup(function(){
		
		$.ajax({
			  type: "POST",
			  url: "salida.php",
			  data: { nombre: $("#campo1").val() }
			}).done(function( msg ) {
				$("#contenido").html(msg);
			  });
		
		})
	
	})

</script>
</body>
</html>

salida.php
Código:
<?php 

echo $_POST['nombre'];
?>
tene en cuenta que la llamada seria casi como un include por lo tanto el archivo salida no deberia tener las etiquetas de head, htm, body ni nada.

revisate

https://api.jquery.com/blur/
https://api.jquery.com/keyup/
https://api.jquery.com/jQuery.ajax/

espero haber ayudado