Tema: Ajax + PHP ?
Ver Mensaje Individual
  #4 (permalink)  
Antiguo 12/03/2011, 16:19
lymyt0
 
Fecha de Ingreso: marzo-2011
Mensajes: 4
Antigüedad: 13 años, 1 mes
Puntos: 0
Respuesta: Ajax + PHP ?

ok! lo he solucionado con ajax

Asi es la pagina

<html >
<head>
<script language="JavaScript" src ="loader.js"> </script>
<title>index</title>
</head>

<body>

<a href="javascript:index()">Inicio</a> /
<a href="javascript:echo1()">echo 1</a> /
<a href="javascript:echo2()">echo 2</a>


<p><? include("index.php");?> </p>

</body>
</html>

Asi es el LOADER.JS

function index()
{ var xmlhttp;
if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); }
else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }
xmlhttp.onreadystatechange=function()
{ if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("content").innerHTML=xmlht tp.responseText; } }
xmlhttp.open("GET","../index.php",true); xmlhttp.send(); }

function echo1()
{ var xmlhttp;
if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); }
else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }
xmlhttp.onreadystatechange=function()
{ if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("content").innerHTML=xmlht tp.responseText; } }
xmlhttp.open("GET","../echo1.php",true); xmlhttp.send(); }

function echo2()
{ var xmlhttp;
if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); }
else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }
xmlhttp.onreadystatechange=function()
{ if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("content").innerHTML=xmlht tp.responseText; } }
xmlhttp.open("GET","../echo2.php",true); xmlhttp.send(); }


y Asi son los archivos

el Index:
<? echo "esto es el index"; ?>
el echo1:
<? echo "esto es el echo1"; ?>
y el echo2:
<? echo "esto es el echo2"; ?>

Solucionado =)