[Resolvido] Carregar js em página carregada com ajax
Bom dia,
To com um problema aqui, preciso carregar um script js em uma página carregada por ajax,
to utilizando php.
A função que carrega mias páginas é:
function PSystem(id,url){
objetoHTML=document.getElementById(id);
objetoHTML.innerHTML="<br /><center><img src='index_arquivos/ajax-loader.gif' style='border:none'></center><br />";
try{
xmlhttp = new XMLHttpRequest();
}catch(ee){
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}catch(E){
xmlhttp = false;
}
}
}
xmlhttp.open("GET",url);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4){
retorno=unescape(xmlhttp.responseText.replace(/\+/g," "));
objetoHTML.innerHTML=retorno;
}
}
xmlhttp.send(null);
};
A função que preciso carregar é:
<script type="text/javascript" src="http://cidades-estados-js.googlecode.com/files/cidades-estados-v0.2.js"></script>
<script type="text/javascript">
function CarregaCidade()
{
new dgCidadesEstados(
document.getElementById('estado'),
document.getElementById('cidade'),
true
);
}
</script>
Porém nao chama a função, tentei colocar em um botão, em onload, e até quando chamo a pagina com o ajax,
porem nada funciona, e testei o código separado em 1 html e voalá funcionou.
Alguem saberia oque fazer?
Grato.
Discussão (4)
Carregando comentários...