I have an index.php which makes a post in conteudo.php, and takes the result and writes in the #contribed div within index.php.
Post:
<script type="text/javascript">
$(this).on('load',function(){
var dadosLink = 'nada';
$.ajax({
url:'conteudo.php',
method: 'POST',
data:{ dados:dadosLink},
success: function(data)
{
$("#conteudo").html(data);
},
error: function(data)
{
$("#conteudo").html(data);
}
});
});
</script>
In the content. php, I have:
<?php require_once('Connections/Gymo.php');
$aba = $_POST['dados'];
if ($aba == "nada") {
echo "
<IFRAME name=Destaques frameBorder=0 style=\"overflow: scroll; height: 100vh; width: 100vw;\" scrolling=auto src=\"inicio.php?dados=".$aba."&mercado=".$mercado."&email=".$email."\">
<div align=\"center\"></div>
</IFRAME>
";
?>
inside the iframe inicio.php, I have:
<div class = "conteudo" id = "conteudo"> Quero replicar esta div para index.php com o mesmo id </div>
My question: How do I get the contents of this div contained in the iFrame to be passed to the div #contento contained in index.php, replacing their values, whatever they are?
This action would have to happen when activating the iframe's ajax function: "$ (this) .on ('load', function () ..."