Context: I have an application that uses php + html + css + '"> jquery ). In it I have a page called principal.php
that contains an iframe: <iframe src=pedido.php/>
within calling pedido.php
, as we can see. Inside the page pedido.php
I have several <input type=text>
and have a specific one that I want to fill with data, next to it we have a lupa
that when clicking on it I execute the following javascript function:
function buscaIndicou(id_elemento){
var parametros = "?disablebuttons=true";
var width = $(window).width()+"px";
var height = $(window).height()+"px";
var $div = $("<div />", { "class":"overflow-box"}).css({"width":width,"height":height});
var $close = $("<div />", {"class":"close"}).click(function(){
$('.overflow-box').remove();
$('.modal').remove();
$('.close').remove();
if (getCookie("IDPessoaModal") == "")
alert("Ocorreu um erro ao selecionar a Pessoa, tente novamente.");
else{
var id = getCookie("IDPessoaModal");
var nm = getCookie("NMPessoaRel");
var ele = getCookie("TargetEdit");
$('#'+ele).val(nm);
$('#'+ele).attr('data-id',id);
deleteCookie("BuscaDoPedido");
}
});
$('#pnlContent').append($div);
var html = '<div class=modal>'+
'<iframe width="987" height="426" frameborder="0" scrolling=no src="listapessoa.php'+parametros+'" id="mainFrame">'+
'</div>';
$('#pnlContent').html($('#pnlContent').html()+html);
$('.modal').append($close);
}
This code opens a <iframe>
on my screen with a modal look, so I go there and pick a Person from the list, save the cookies that I use there after in the event of click()
of div.close
and then click on div.close
that gives .remove()
to everything I've created.
Problem: When the elements that I created are removed, and I see my <input>
and the magnifying glass, the information is loaded to it correctly, however, all other <input>
which I have filled, are empty.
Why were they empty if I did not reload or close <iframe src=pedido.php>
and just created another <iframe>
inside it after I closed it?
I'm sure there's no problem with PHP or HTML code, so I did not post anything, but if you insist I can try to create a similar example because my PHP + HTML code is difficult to understand and is huge. / p>