0 Members and 1 Guest are viewing this topic.
<div id="content"> <object id="text" width="600" height="450" type="text/html" border="0" style="overflow: hidden;"></object></div>
$(document).ready(function() { $('#text').attr('data', "hometext.html");});
try $('#text').data="hometext.html";
It probably is changing the data attribute correctly, but that doesn't mean the user's browser loads the new data.
Is there a way I can make it load it, like updating it? Thanks.
$(document).ready(function() { $('#text').data="hometext.html"; $('#projetos').click(function() { 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("text").data="projetos.html"; alert("hey"); } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); //$('#text').attr('data', "projetos.html"); });});
GET http://(...)/ajax_info.txt 404 (Not Found)
<!DOCTYPE html><html> <body> <object id="text" width="600" height="450" type="text/html" border="0" style="overflow: hidden;"></object> </body> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> <script> $(document).ready(function() { $('#text').attr('data', 'http://www.google.co.uk'); }); </script></html>