Este es el codigo de la pagina que quiero abrir
[avisos1.php]
Código:
<link rel="stylesheet" href="acordeonmenu/css/reset.css" type="text/css" charset="utf-8">
<link rel="stylesheet" href="acordeonmenu/css/core.css" type="text/css" charset="utf-8">
<link rel="stylesheet" href="acordeonmenu/css/accordion.core.css" type="text/css" charset="utf-8">
<link href="acordeonmenu/acordeon.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="acordeonmenu/js/jquery-1.4.2.min.js" charset="utf-8"></script>
<script type="text/javascript" src="acordeonmenu/js/jquery.accordion.2.0.js" charset="utf-8"></script>
<link href="STYLE/horizontalmenu.css" rel="stylesheet" type="text/css" />
<ul id="example2" class="accordion">
<li>
<h3 >Avisos</h3>
<div id="asdf" class="panel loading">
<p>
<table width="100%" border="1" class="tablaavisos" id="as">
<tr>
<td width="26%" height="20">Nombre</td>
<td width="37%">Apellido</td>
<td width="18%">D.N.I.</td>
<td width="19%">Dias</td>
</tr>
</table>
</p>
</div>
</li>
</ul>
<script type="text/javascript">
$('#example2').accordion({
canToggle: true
});
$(".loading").removeClass("loading");
</script>
Y este es el codigo de la pagina que se encarga de abrir avisos1.php mediante ajax
[index.php]
Código:
<!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>Documento sin título</title>
<link rel="stylesheet" href="acordeonmenu/css/reset.css" type="text/css" charset="utf-8">
<link rel="stylesheet" href="acordeonmenu/css/core.css" type="text/css" charset="utf-8">
<link rel="stylesheet" href="acordeonmenu/css/accordion.core.css" type="text/css" charset="utf-8">
<link href="acordeonmenu/acordeon.css" rel="stylesheet" type="text/css">
<link href="STYLE/tablaavisos.css" rel="stylesheet" type="text/css" />
<link href="STYLE/botonavisos.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="acordeonmenu/js/jquery-1.4.2.min.js" charset="utf-8"></script>
<script type="text/javascript" src="acordeonmenu/js/jquery.accordion.2.0.js" charset="utf-8"></script>
<link href="STYLE/horizontalmenu.css" rel="stylesheet" type="text/css" />
</head>
<body>
<a href="#" onClick="getID(this)" title="Avisos"><span>Avisos</span></a>
<div id="contenido"></div>
</body>
</html>
<script type="text/javascript">
function getID(theLink){
enviar(theLink.id);
}
function enviar(idform){
// Comprobamos que está disponible AJAX
if(window.XMLHttpRequest) {
ajax = new XMLHttpRequest()
}
// La respuesta aparecerá en una alerta
ajax.onreadystatechange=function(){
if(ajax.readyState == 4) {
if(ajax.status == 200) {
//print(ajax.responseText)
//an.style.display='none';
document.getElementById("contenido").innerHTML=ajax.responseText;
}
}
}
// Pedimos el archivo "prueba.php"
ajax.open("POST","avisos1.php",true)
ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
ajax.send(null)
}
</script>