Mod_rewrite pick up variables
I want to crate nicer url´s on my Jquery Mobile page.
Now I have Ex. store.html?supplier=apple&product=laptops
My code to capture the variables.
- var supplier = getUrlVars()["supplier"];
- var product = getUrlVars()["product"];
- function getUrlVars() {
- var vars = [], hash;
- var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
- for(var i = 0; i < hashes.length; i++)
- {
- hash = hashes[i].split('=');
- vars.push(hash[0]);
- vars[hash[0]] = hash[1];
- }
- return vars;
- }
But now I want to create a little nicer urls.
apple/laptops
But how will I manage to capture the variables, apple and laptops in my javascript?
Many thanks in advance!