Hello friends,
I have a problem working with the Request.HTML in InternetExplorer,
the problem is that the answer does not load the page in the PHP DIV
container, is not what happens to revise the DOM in the tool to
developers if the whole burden PHP file contents but not show it in
the container.
They step to revise the code, if aver found the error:
Javascript:
<code>
<script type="text/javascript">
function cargaAjax(url, metodo, datos , contenedor, evaluar){
var divCarga = new Element('div',{'class': 'precarga','html':
'Cargando...'});
new Request.HTML({
url: url,
method: metodo,
data: datos,
update: $(contenedor),
evalScript: evaluar,
onRequest: function(){
$(contenedor).empty();
$(contenedor).grab(divCarga);
divCarga.setStyle('display','block');
},
onSuccess: function(result){
divCarga.setStyle('display','none');
divCarga.empty();
divCarga.destroy();
}
}).send();
}
window.addEvent('domready', function(){
cargaAjax('./modulos/noticias/
noticias.ajax.php','get','','noticia',true);
});
</script>
</code>
Ahora el HTML:
<code>
<div id="noticia"></div>
</code>
y el PHP:
<code>
<?php require_once('con.php'); ?>
<?php
include("../Basicas.php");
mysql_select_db($database_mar, $mar);
$query_noticias = "SELECT noticias.id_noticia, noticias.tit_noticia,
noticias.res_noticia FROM noticias ORDER BY noticias.fec_noticia DESC
LIMIT 3";
$noticias = mysql_query($query_noticias, $mar) or die(mysql_error());
$row_noticias = mysql_fetch_assoc($noticias);
$totalRows_noticias = mysql_num_rows($noticias);
?>
<!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>Noticia</title>
<link href="../../estilo.css" rel="stylesheet" type="text/css"
media="all" />
</head>
<body>
<?php if ($totalRows_noticias > 0) { // Show if recordset not empty ?>
<table width="95%" border="0" align="center" cellpadding="2"
cellspacing="0">
<?php do { ?>
<tr>
<td><span class="titularnews_box"><?php echo
$row_noticias['tit_noticia']; ?></span><br />
<span class="textogeneral1"><?php echo
$row_noticias['res_noticia']; ?></span></td>
</tr>
<tr>
<td><div align="center"><img src="images/punteados.jpg"
alt="1" width="149" height="10" /></div></td>
</tr>
<?php } while ($row_noticias = mysql_fetch_assoc($noticias)); ?>
<tr>
<td><div align="center" class="textolink"><a href="./
noticias.php">Ver más</a></div></td>
</tr>
</table>
<?php } // Show if recordset not empty ?>
<?php if ($totalRows_noticias == 0) { // Show if recordset empty ?>
<div style="padding:5px; text-align:center; font-weight:bold; font-
family:Arial, Helvetica, sans-serif; color:#666666; font-size:
12px;">No hay noticias registradas en el sitio.</div>
<?php } // Show if recordset empty ?>
</body>
</html>
<?php
mysql_free_result($noticias);
?>
</code>
_____________________________________________________________________________________
Hola amigos,
Tengo un problema al trabajar con el Request.HTML en InternetExplorer,
el problema es que no carga la respuesta de la pagina PHP en el DIV
contenedor, no se que es lo que pasa al revisar el DOM en la
herramienta para desarrolladores si carga todo el contenido del
archivo PHP pero no lo muestra en el contenedor.
Les paso el codigo para que revisen, aver si encuentran el error:
Javascript:
<code>
<script type="text/javascript">
function cargaAjax(url, metodo, datos , contenedor, evaluar){
var divCarga = new Element('div',{'class': 'precarga','html':
'Cargando...'});
new Request.HTML({
url: url,
method: metodo,
data: datos,
update: $(contenedor),
evalScript: evaluar,
onRequest: function(){
$(contenedor).empty();
$(contenedor).grab(divCarga);
divCarga.setStyle('display','block');
},
onSuccess: function(result){
divCarga.setStyle('display','none');
divCarga.empty();
divCarga.destroy();
}
}).send();
}
window.addEvent('domready', function(){
cargaAjax('./modulos/noticias/
noticias.ajax.php','get','','noticia',true);
});
</script>
</code>
Ahora el HTML:
<code>
<div id="noticia"></div>
</code>
y el PHP:
<code>
<?php require_once('con.php'); ?>
<?php
include("../Basicas.php");
mysql_select_db($database_mar, $mar);
$query_noticias = "SELECT noticias.id_noticia, noticias.tit_noticia,
noticias.res_noticia FROM noticias ORDER BY noticias.fec_noticia DESC
LIMIT 3";
$noticias = mysql_query($query_noticias, $mar) or die(mysql_error());
$row_noticias = mysql_fetch_assoc($noticias);
$totalRows_noticias = mysql_num_rows($noticias);
?>
<!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>Noticia</title>
<link href="../../estilo.css" rel="stylesheet" type="text/css"
media="all" />
</head>
<body>
<?php if ($totalRows_noticias > 0) { // Show if recordset not empty ?>
<table width="95%" border="0" align="center" cellpadding="2"
cellspacing="0">
<?php do { ?>
<tr>
<td><span class="titularnews_box"><?php echo
$row_noticias['tit_noticia']; ?></span><br />
<span class="textogeneral1"><?php echo
$row_noticias['res_noticia']; ?></span></td>
</tr>
<tr>
<td><div align="center"><img src="images/punteados.jpg"
alt="1" width="149" height="10" /></div></td>
</tr>
<?php } while ($row_noticias = mysql_fetch_assoc($noticias)); ?>
<tr>
<td><div align="center" class="textolink"><a href="./
noticias.php">Ver más</a></div></td>
</tr>
</table>
<?php } // Show if recordset not empty ?>
<?php if ($totalRows_noticias == 0) { // Show if recordset empty ?>
<div style="padding:5px; text-align:center; font-weight:bold; font-
family:Arial, Helvetica, sans-serif; color:#666666; font-size:
12px;">No hay noticias registradas en el sitio.</div>
<?php } // Show if recordset empty ?>
</body>
</html>
<?php
mysql_free_result($noticias);
?>
</code>