Transmit information between html pages with jQuery?

1

Good afternoon person, alright?

In my project, I have a list of properties, all different from each other. When clicking on any of them, you should open a detail page with unique information about the property clicked. The problem is communicating my results page with the detail page.

I had to make the communication through an id ... See my example:

<!-- RESULTADO.html -->
    <ul id="resultado-pesquisa">
        <li class="itens-pesquisa"><a id="0101" >Clicar para detalhes</a></li>
        <li class="itens-pesquisa"><a id="0202" >Clicar para detalhes</a></li>
        <li class="itens-pesquisa"><a id="0303" >Clicar para detalhes</a></li>
    </ul>

What I need is: Click the anchor and move the id to the detail page via jQuery! Is it possible?

Thank you, good week to everyone!

    
asked by anonymous 06.06.2016 / 22:51

1 answer

1

@Joao Souza can do with hash , so excuse to operate with cookies for this:

<ul id="resultado-pesquisa">
    <li class="itens-pesquisa"><a id="0101" href="detalhes.html#0101">Clicar para detalhes</a></li>
    <li class="itens-pesquisa"><a id="0202" href="detalhes.html#0202">Clicar para detalhes</a></li>
    <li class="itens-pesquisa"><a id="0303" href="detalhes.html#0303">Clicar para detalhes</a></li>
</ul>

Then on page detalhes.html , you can get the id in the href where you clicked on the previous page, for example on page detalhes.html#0101 :

var id_imovel = location.hash;
console.log(id_imovel); // #0101 
    
06.06.2016 / 22:59