javascript - Load another page in page and append another url -


i have looked everywhere have no idea how go it.

i want have links @ top of page such as; news | reviews | images etc

when clicks on 1 links, want load content php file , @ same time append link name on url. example: example.com/page1/review.

i have seen other sites http://www.gamespot.com/the-witcher-3-wild-hunt/

i don't have code examples because not sure how start. tried .load not found works.

you can use history api, can use either pushstate or replacestate replace url

history.pushstate({},"","/the/new/url"); //or history.replacestate({},"","/the/new/url"); 

the parameters both functions same. first 1 object gets stored , passed onpopstate event. can retrieve history.state in event of browser restart.

the second title string, believe @ moment no browsers utilize can whatever.

the last parameter new url want in address bar.

so if wanted load images link , wanted url /images like

jquery("#content").load("/images.php").then(function(){    history.replacestate({},"","/images"); }); 

session history management compatibility


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -