How can I get a variable of a hash in php.
I have a variable on page like this
catalog.php#album=2song=1
How can i get the album an
You can use AJAX/PHP for this. You can get the hash with javaScript and load some contents with PHP. Let's suppose we're loading the main content of a page, so our URL with hash is "http://www.example.com/#main":
JavaScript in our head:
function getContentByHashName(hash) { // "main"
// some very simplified AJAX (in this example with jQuery)
$.ajax({
url: '/ajax/get_content.php?content='+hash, // "main"
success: function(content){
$('div#container').html(content); // will put "Welcome to our Main Page" into the with id="container"
}
});
}
var hash=parent.location.hash; // #main
hash=hash.substring(1,hash.length); // take out the #
getContentByHashName(hash);
The PHP could have something like: