I'm using history API to load the clicks on the menu, in a div #content, okay so far so good, however I'm handling the errors by JQUERY even look at it
$('a').click(function() {
pageurl = $(this).attr('href');
if(pageurl!=window.location){
window.history.pushState({path:pageurl},'',pageurl);
}
$('#conteudo').load($(this).attr('href'), function(responseText, statusText, xhr)
{
if(xhr.status == 403) {
$('#conteudo').load("/error/error403");
}
if(xhr.status == 404) {
$('#conteudo').load("/error/error404");
}
if(xhr.status == 405) {
$('#conteudo').load("/error/error405");
}
});
return false;
});
I would like the opinion if this is really feasible, since I am using VRAPTOR and can only imagine this way of treating the errors in an "efficient" way, does anyone have problems or can you see a possible problem?
If this is relevant, if the controller does not exist it sends the non-existent page error (404), if the user tries to access a method not allowed, returns the 403 (forbidden) and so on ..
EDITED for question 2:
Well, I have the following structure
I have the index.php that contains 2 divs
<div id="menu">
e <div id="conteudo">
When you load the index, it pulls with .load (/ test / menu) to the div = menu
It works perfectly, except that if I type in the navigated / test / LinkClicado or / test / menu, it will simply open only the respective ones without the correct division, the linkClicado will open only the html referring to it without the MENU above ... and so if I open the link / test / menu, it will show only the menu without the content
How do I open the / test / LinkClicado link to open the COMPLETE page that would be / test / index, but in the position relative to the link typed in the case / test / LinkClicado