Opening outer page without refresh

Asked

Viewed 34 times

-2

How can I show a link or div by clicking one without refresh on the page

<li>
                    <a data-toggle="collapse" href="#pagesExamples">
                        <i class="pe-7s-gift"></i>
                        <p>Comprar BCC | Buy BCC
                           <b class="caret"></b>
                        </p>
                    </a>
                    <div class="collapse" id="pagesExamples">
                        <ul class="nav">
                            <li>
                                <a href="#">
                                    <span class="sidebar-mini">BTC</span>
                                    <span class="sidebar-normal">Bitcoin</span>
                                </a>
                            </li>
                        </ul>
                    </div>
                </li>
            </ul>
        </div>
    </div>

Div that should appear when clicking on the Bitcoin span

<div class="btn-content-rc">
   <div class="rc-btn-payment"
  data-amount="100" 
  data-iso4217="BRL" 
  data-button="white" 
  data-refer_id="****" 
  data-token="976808fb-********33" 
  data-email_client="****[email protected]"> <!-- --> </div>
  <div class="btc-address-rc">
  </div>
 </div>

1 answer

-1


For a more complete answer it would be necessary that you post some code from your page, but assuming that it could be a simple link:

You need to insert some anchor into your HTML.

<a href='/oi.php'>Ir para página</a>

href is an attribute used to define for which link a certain html tag is attached, and the user will be sent if he performs a specific iteration with this tag.

Example: user clicks on a link with the tag:

<a href="www.google.com">Clique aqui</a>

is sent to the page www.google.com.

EDIT:

To open a page on a part of the site you can use the iframe, follows an example implementation:

<div>
  <a id="link">Mostrar página</a>
  <iframe id="myIframe" src="user/login">
  </iframe>
</div>

Javascript:

document.getElementById('link').onclick = showIframe;

function showIframe(){

  document.getElementById('myIframe').style.display = 'block';
  console.log('called')
}

CSS:

#myIframe { display:none; }

Link to working code: http://jsfiddle.net/6NZaS/55/

  • Got it, buddy. But how can I open other pages inside my template ? When the user clicks, for example, on Charts, it opens in the blank part of the template

  • I will edit the post, please try to reply if possible.

  • @PLINIORODRIGUES I edited my answer, and put an example code.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.