1
I’m having a hard time creating a menu where pages are loaded into a div.
What happens is that I’m creating an application following the MVC standard, and I do the treatments of the Urls to redirect them, to each controller, I don’t know what happens when it loads the page it doesn’t specifically open in div where I predefined.
Code jQuery:
jQuery(function () {
jQuery('.ler').click(function () {
jQuery('#open').load('corpo.php', function (e) {
e.preventDefault();
});
});
})
HTML code:
<ul class="nav navbar-nav side-nav">
<li class="active"><a href="<?php URL?>dashboard"><i class="fa fa-dashboard"></i> Dashboard</a></li>
<li><a href="javascript:void(0)" class="ler"><i class="fa fa-bar-chart-o"></i> Categorias</a></li>
<li><a href="<?php URL?>noticia" class="ler"><i class="fa fa-table"></i> Noticias</a></li>
<li><a href="<?php URL?>galeria" class="ler"><i class="fa fa-edit"></i> Galeria</a></li>
<li><a href="<?php URL?>comentarios" class="ler"><i class="fa fa-font"></i> Comentarios</a></li>
<li><a href="<?php URL?>informacoes" class="ler"><i class="fa fa-font"></i> Informacoes</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-caret-square-o-down"></i> Menu <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Enviar Email</a></li>
<li><a href="#">Gerir Usuarios</a></li>
</ul>
</li>
</ul>
And the div where the pages will be loaded:
<!-- /#navegacao -->
<div id="open"></div>
<!-- /#navegacao //Fim -->
Sam you are using the function inside :load() in the wrong way. What do you want with the
.preventDefault()? This function is the function that runs when ajax succeeds, and the parametere(which is usually called "resposnse") is the answer, probably HTML...– Sergio