Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

222
Visualizações
How to change the web address,at the same time, only refresh a part of page?

I used Ajax to refresh page.but the address has not chenged.

function refresh(page) {
        let xmlhttp;
        if (window.XMLHttpRequest)
        {
            xmlhttp=new XMLHttpRequest();
        }
        else
        {
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange=function()
        {
            if (xmlhttp.readyState==4 && xmlhttp.status==200)
            {
                document.getElementById("test").innerHTML=xmlhttp.responseText;
            }
        }
        xmlhttp.open("GET",page,true);
        xmlhttp.send();
    }

I add this in order to change address

        let newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + '?foo=bar';
        window.history.pushState({path:newurl},'',newurl);

It's can work, but, I cant visit the website using this new url. I want my web site like the Android Guides. when I changed the address. only refresh a part of page.

For example: My website is "mywebsite.com/test.php"; I add the newurl to change address like about,it become "mywebsite.com/php?foo=bar#". but when I input this address in address bar. the page still is "mywebsite.com/test.php"

Did you what I mean

Please excuse me for my bad english!

solution: Maybe, I can ask this quesion like this, 'How to hot refresh the page?'

reference: Vue.js and javascript history API

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda