Tengo tres páginas.
1- Index.htm
Código:
2- Página: ajax.js<html> <head> <script language="JavaScript" type="text/javascript" src="ajax.js"></script> </head> <body> <div align="center"> <table border="0" width="558" cellspacing="0" cellpadding="0" id="table1"> <tr> <td> <div id="resultado" name="resultado">Aca resultado</div> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td><a href="#" onClick="pasonumero(1);">1</a></td> <td> </td> </tr> </table> </div> </body> </html>
Código:
3- Página: numero.php<script>
function objetoAjax()
{
var xmlhttp=false;
try
{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (E) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
{
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}
///////////////////////////////////////////////////////////////
function pasonumero(id)
{
divResultado = document.getElementById('resultado');
ajax=objetoAjax();
ajax.open("POST","numero.php",true);
ajax.onreadystatechange=function()
{
if (ajax.readyState==4) {
divResultado.innerHTML = ajax.responseText
}
}
ajax.send("id="+id)
}
</script>
Código:
Al hacer click sobre el 1 del INDEX.HTM, me sale error. Alguno me podria dar una mano.$id = $_POST["id"]; echo $id;
Gracias.

