0
I made a page index
calling another page inside the div
. But I came across a simple problem: the page appears inside the div
of the page index
, where I have with search field, only that by clicking the button or the one enter in the field, does not load the function. I made a test with this page that calls inside the div
separate and the inputs
carry, but calling her inside the div
index page not load function.
My code is below:
//esse javascript é o que chama a pagina dentro da <div>
<script>
function display_c(){
setInterval('getInfo()',30000);
}
function getInfo(){
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("conteudo").innerHTML = xmlhttp.responseText;
}
};
xmlhttp.open("GET", "MRB_Dados.php?op=<?php echo $op;?>", true);
xmlhttp.send();
}
$.post('MRB.php',function(html){
$('#coteudo').html(html);
});
</script>
//aqui é a <div> que vai receber a pagina.
<div id="conteudo"></div>
//e esse é os inputs que eu chamo da outra pagina que vai aparecer dentro da <div>.
<section>
<table border="0" align="center">
<tr>
<td width="300">
<input type="search" placeholder="" id="bs-prod"/>
<input type="hidden" name="str" id="str" value="aqm"/>
<input type="hidden" name="str" id="str" value="aqm"/></td>
<td>
<input class="btn btn-danger" type="submit" value=" Pesquisar ">
<input type="hidden" name="pesquisar" value="sim">
</td>
</tr>
</table>
</section>
I could put the HTML of the two pages?
– user6476
If you have put Javascript/jQuery functions related to the page that will be called on the main page, it will not even work. Javascript will search for the specified elements and, as it did not find it, will error. You have to call the page and, with it, the related Javascript content. There is a technique to circumvent this, but it is complicated and inefficient.
– Clayderson Ferreira
Clayderson could you send me an example of how to call the javascript function along with the page please
– Danilo Eugenio