$(document).ready(function(){ ajaxIpos = new ajax("/tr/bi/ofertas/ofertas.xml?rand=" + new Date().getTime(),"preencheIpos(this.retornoText,this.retornoXml)"); }); function preencheIpos(conteudoText,conteudoXml){ try{ var qtdIpos = conteudoXml.getElementsByTagName("item"); if(qtdIpos.length >= 1){ $("#alertas").html(""); $("#alertas").hide(); buildIpos(qtdIpos); }else{ $("#alertas").html("Aguardem novas IPO's"); $("#alertas").show(); } }catch(e){$("#alertas").html(e)}; }