jQuery Fadein Page on Anchor Click Problem -
i'm having problem loading external pages div using jquery.
i want include external page specific div when anchor link clicked.
the problem is when click link, , after external page has loaded removed rest of page's content after :/
<script type="text/javascript"> function ahah(url, target) { document.getelementbyid(target).innerhtml = ' fetching data...'; if (window.xmlhttprequest) { req = new xmlhttprequest(); } else if (window.activexobject) { req = new activexobject("microsoft.xmlhttp"); } if (req != undefined) { req.onreadystatechange = function() {ahahdone(url, target);}; req.open("get", url, true); req.send(""); } } function ahahdone(url, target) { if (req.readystate == 4) { if (req.status == 200) { document.getelementbyid(target).innerhtml = req.responsetext; } else { document.getelementbyid(target).innerhtml=" ahah error:\n"+ req.status + "\n" +req.statustext; } } } function load(name, div) { ahah(name,div); return false; } </script> <div id="content"></div> <a href="file1.html" onclick="load('page.php','content');return false;">file 1</a>
can help, thanks!
a guess page.php
returns full html document, including </body>
, </html>
tags, making browser not render of original page content after these tags.
Comments
Post a Comment