basically i use functions like:
function ver_pregunta(id){
$("#router").fadeOut(100).load('./includes/router.php?que=ver_pregunta&id='+id).fadeIn(1000);
return false;
}
to load new content asynch. ok, but i’m allways using same URL, how Can i just update URL, TITLE and DESCRIPTION with JS/JQuery?
you can only set the name anchor in the url basically yourpage.com/#/someurl/
it’s not possible to change the whole url without reloading the whole page.
To set the name anchor you need to do this:
If you want to use it like that (to point to your page with name anchor) you’ll need to define some kind of check to load proper content with
ver_preguntafunction, basically take the location.hash e.g. if your url =www.someurl.com/#myidyou can run:or better set a list of allowed ids:
and compare it with
location.hash:For title use:
For description:
If you want to do it for SEO reasons it won’t work, Google bots don’t use JS, they’ll pick up only static HTML
Cheers
G.