Bom dia, eu estou a tentar carregar um url da base de dados para uma iframe. Se adicionar manualmente o url atraves de ".attr" ele abre normalmente na iframe mas qd tento carregar da base de dados não o faz. Vou deixar aqui o html e o php a ver se alguem me consegue dar uma ajuda.
Código (HTML5):
Código (PHP):
Quanto à base de dados é em mysql e tem um campo em text com o seguinte: "http://www.sapo.pt" .
Código (HTML5):
<?php include 'load_url.php'; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="keywords" content="jquery,ui,easy,easyui,web">
<meta name="description" content="easyui help you build your web page easily!">
<title>Async Tree - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/demo/demo.css">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
</head>
<body>
<div style="width: 350px; float: left;">
<ul id="tt" class="easyui-tree" url="get_datav4.php" data-options="animate:true" >
</ul>
</div>
<iframe id="a" style="width: 1000px; height: 800px; float: right; visibility: hidden;">
</iframe>
<script language="Javascript" type="text/javascript">
//TORNA A IFRAME VISIVEL
$('#tt').tree({
onclick: function(){
console.log('Inicio..');
$("#a").css("visibility","visible");
$("#a").load("load_url.php");
console.log('Fim...');
}
});
</script>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="keywords" content="jquery,ui,easy,easyui,web">
<meta name="description" content="easyui help you build your web page easily!">
<title>Async Tree - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/demo/demo.css">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
</head>
<body>
<div style="width: 350px; float: left;">
<ul id="tt" class="easyui-tree" url="get_datav4.php" data-options="animate:true" >
</ul>
</div>
<iframe id="a" style="width: 1000px; height: 800px; float: right; visibility: hidden;">
</iframe>
<script language="Javascript" type="text/javascript">
//TORNA A IFRAME VISIVEL
$('#tt').tree({
onclick: function(){
console.log('Inicio..');
$("#a").css("visibility","visible");
$("#a").load("load_url.php");
console.log('Fim...');
}
});
</script>
</body>
</html>
Código (PHP):
<?php
include_once 'acess_db.php';
$rs = mysql_query("select url from dados3 where id=1");
while($row = mysql_fetch_array($rs))
{
$url = $row["url"];
}
return $url;
?>
include_once 'acess_db.php';
$rs = mysql_query("select url from dados3 where id=1");
while($row = mysql_fetch_array($rs))
{
$url = $row["url"];
}
return $url;
?>
Quanto à base de dados é em mysql e tem um campo em text com o seguinte: "http://www.sapo.pt" .