i’m loading external contents inside a page with .load().
in my index.html i have this code:
$(document).ready(function(){
$("#conteudo_mostrar").load("inicial.html");
});
and
<div id="conteudo_mostrar"></div>
so, in my inicial.html i have another link to contact.html, and when someone clicks that link (contact link inside of inicial.html) I need to replace the inicial.html to contain contact.html inside the same div #conteudo_mostrar on the page index.html
How to do that??
You can use
.get()and suppose you have a link forcontact.html:Then:
If in case you’re going to add more links, you’ll just do the same for every
id. If you have another link, let’s say forgallery.html:You’ll just need to append it in your code, just like the one in
lnkContact, just change it tolnkGallery:Your whole code will now be:
And for every other links, you just need to make the same changes. Provided that you have an
idattribute to distinguish each link.A more efficient way by Preston
Tag each link by
linkclass:Then: