// JavaScript Document URLatual = location.href; $(document).ready( function() { URLatual = location.href; carregaPagina(); setInterval('verificaURL()',500); } ); function mostraRep(html) { $('#listagem_representantes').html(html); //CorTabela(); } function verificaURL() { if(location.href != URLatual) { if(location.href.indexOf('#')<0) window.location.reload(); else { //alert(URLatual+' = '+location.href); carregaPagina(); } } } estado = ''; function carregaPagina() { URLatual = location.href; raca = ''; if(location.href.indexOf('#')>1) { estado = location.href.split('#'); estado = estado[1]; } //alert(raca); if(estado == '' || estado == 'undefined') { document.title = "CRI Genética - Representantes"; $.post('/representantes/estado',{ estado:estado,inicio:1 }, function(response) { mostraRep(response); } ); } else { document.title = "CRI Genética - Representantes"; $.post('/representantes/estado',{ estado:estado }, function(response) { mostraRep(response); } ); } }