Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/01/2012, 11:05
nacho103
 
Fecha de Ingreso: marzo-2010
Mensajes: 3
Antigüedad: 14 años, 1 mes
Puntos: 0
Pregunta Duda de Novato. Llamada a php desde HTML

Muy buenas.
Soy muuuy nuevo en esto y ya me ha llegado mi primera gran duda.
He creado un php que, al llamarlo pasandole 2 argumentos, la tabla y un valor de control, me genera un fichero txt con los campos de esa tabla.
Hasta aqui todo correcto.
El problema me llega cuando quiero que ejecute esa opcion y cierre el explorador.
Tras leer y releer veo que con php no se puede.
Segun tengo entendido, lo mejor hacer un html y llamar al php con ajax, pero todos los ejemplos que encuentro son con un boton, etc y aunque los he probado no me funcionan.
Os pongo mi codigo html por si me podeis echar una mano.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-type" content="text/html; charset=utf-8" />

<title>Consulta AJAX</title>

<script src="http://www.google.com/jsapi"></script>
<script>google.load("jquery", "1");</script>
<script type="text/javascript" src="/ajax.js"></script>
<script type="text/javascript" src="/jquery.js"></script>

<script type='text/javascript'>

$(document).ready(function ()
{
$('#id').click(function()
{
$.ajax ({

url:'consulta.php',
type:'GET',
data:"tabla=clientes&control=12345"

});
});
});

</script>

</head>

<body>
//AQUI ES DONDE NO SE COMO LANZAR EL CODIGO JAVASCRIPT
<a href="#" myid="id"> AAA</a>
</body>
</html>