index.php
Código:
Esto son los ficheros que se cargan mediante ajax:<!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> <title>prueba parse</title> <link href="estilo.php" rel="stylesheet" type="text/css" /> <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js' type='text/javascript'/></script> <script> function nuevoAjax(){ 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; } // Función para cargar los contenidos de forma asíncrona. // + pagina: fichero cuyo contenido queremos cargar. // + identidicador del elemento en el que se cargará el nuevo contenido. function cargarbio(pagina,destino){ var contenedor; var ajax; contenedor = document.getElementById(destino); ajax = nuevoAjax(); ajax.open("GET", pagina, true); ajax.onreadystatechange=function() { if (ajax.readyState==4) { contenedor.innerHTML = ajax.responseText; } } ajax.send(null); } </script> <script> content.load(this.href, function () { FB.XFBML.parse(); }); </script> </head> <body> <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/es_ES/sdk.js#xfbml=1&version=v2.4&appId=578756808801583"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <div id="centro"> <div id="botonera"> <div id="botonera-superior"> <div class="contenedormenu"><ul class="menu-galeria"> <li><a href="#" onClick="cargarbio('comentarios.php','contenido-texto')" _gaq.push(['_trackEvent', 'biografia','ver-biografia'>INICIO</a></li> <li><a href="#" onClick="cargarbio('ficha.php','contenido-texto')" _gaq.push(['_trackEvent', 'biografia','ver-biografia'>BIOGRAFIA</a></li> </ul> </div> </div> </div> <div id="contenido-texto"> <div class="redes-radio"><div class="facb-radio"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.example.com&width&layout=button_count&action=like&show_faces=false&share=false&height=21&appId=578756808801583" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:21px;" allowTransparency="true"></iframe></div></div> <div id="para-comentarios-radio"> <div class="fb-comments" data-href="http://www.example.com/" data-width="662" data-num-posts="30"></div> </div> </div> </div> </div> </body> </html>
ficha.php
Código HTML:
<div id="para-descripcion"> <div class="redes-radio"><div class="facb-radio"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2www.example.com&width&layout=button_count&action=like&show_faces=false&share=false&height=21&appId=578756808801583" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:21px;" allowTransparency="true"></iframe></div></div> <div id="para-comentarios-radio"> <div class="fb-comments" data-href="http://www.example.com/" data-width="662" data-num-posts="36"></div> </div>
comentarios.php
Código:
A ver quien me puede echar un cable.<div class="facb-radio"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fhttp://www.example.com&width&layout=button_count&action=like&show_faces=false&share=false&height=21&appId=578756808801583" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:21px;" allowTransparency="true"></iframe></div> <div id="para-comentarios-radio"> <div class="fb-comments" data-href="http://www.example.com/" data-width="662" data-num-posts="36"></div> </div>
![Golpeado](http://static.forosdelweb.com/fdwtheme/images/smilies/pelea.png)
![Golpeado](http://static.forosdelweb.com/fdwtheme/images/smilies/pelea.png)