1
Use MVC5 and Visual Studio 2013. I created this route: Home/PaginaBase
. This route calls a new page, called PaginaBase
, which has a header and footer similar to Index
. This footer creates a Menu. When I select an item from that menu, it calls me to PaginaBase
, mounting the URL like this:
So far, ok. When I will select another item (I am still inside the PaginaBase
), it keeps the same URL in the call and adds again Home/PaginaBase/8/3
, there is a route missing. How do I solve this?
Below my jquery function
function MontaMenuInferior() {
var str = "";
$.ajax({
url: '/Home/MontaMenuInferior',
dataType: "json",
contentType: "application/json; charset=utf-8",
type: "POST",
success: function (data) {
$(data.resultado).each(function () {
str = str + '<ul class="grid_4">' +
'<li>' + this.SubCategoria + '</li>';
$(this.subconsulta).each(function () {
if (this.Id_SubCategoria2 != null)
str = str + '<li><a href="Home/PaginaBase/' + this.Id_SubCategoria2 + '/3" title="">' + this.SubCategoria2 + '</a></li>';
//str = str + '<li><a href="@Url.RouteUrl(PaginaBase"',new{ Parametro : this.Id_SubCategoria2, tipo : '3'} + ")">this.SubCategoria2 + '</a>'
else
str = str + '<li><a href="#' + this.SubCategoria2 + '" title="">' + this.SubCategoria2 + '</a></li>';
});
str = str + '</ul>';
$('#menufooter').append(str);
str = "";
});
},
error: function (error) {
}
});
}
Why these numbers at the end of your Urls? Wouldn’t it be better to just use the proper view names?
– Tiago César Oliveira
What do you mean? These numbers are parameters I step to call certain html. They are bd ID’s.
– pnet
The problem of duplication, is that there was a bar missing in the link call, type: /Home/Paginabase... and not Home/Paginabase.... That I already solved, now called my attention in relation to the name suggested by Tiago.
– pnet