Ajax - How to change URL by content -


I will explain: I have a picture gallery, the first page is display.php . Users can flip through pictures using arrows, when you click on an arrow, it sends an Ajax request to get the next image from DB. Now I want the URL to be changed according to the picture.

  So if the first picture is: www.mydomain.com/display.php?picture=Paris at night  

I will flip to the next one and the URL

  www.mydomain.com/display.php?picture=The Big Ben  

How can I do this?

The trick here is spaced with an anchor piece.

is a part of the first of the '#' points for a resource on the Internet, and normally after assigning the anchor to the page.

The browser is the same, the browser does not refresh but is currently moved to anchor position.

In this way you can keep the browser history from an usable point of view, while on the page some parts can be kept with Ajax for fast and responsive user interface. / P>

Using a plugin like jQuery's history (as suggested by others) is really simple: you decorate some specific elements with a rel attribute through which the plug-in rest takes care of keeps.

Some of the topics related to this topic are called 'hijacks', and this is actually something I like.

This means that just generating HTML you have abducted some special behaviors in the old days prior to AJAX, and request content with AJAX, only to replace the required parts . It really allows SEO friendly and accessible webpages in conjunction with the above techniques.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -