Simple hash routing library, doesn't require any dependency. It routes strings after the symbol "#".
url : http://localhost/index.html#home ```javascript hrouter("home", function () { $('#text').html("Home ! "); }); ``` url : http://localhost/index.html#home/1 ```javascript hrouter("home/:page", function (page) { $('#text').html("Home page #" + page); }); ``` url : http://localhost/index.html#greetings/page1 ```javascript hrouter("greetings/page:number", function(number) { $('#text').html("Home page # " + number); }); ``` url : http://localhost/index.html#greetings/page1/contact ```javascript hrouter("greetings/page:number/:section", function(number, section) { $('#text').html("Home page # " + number + " section " + section); }); ``` url : http://localhost/index.html#search/zombies-without-eyes ```javascript hrouter("search/*",function (search) { $('#text').html(" Find this text *" + search + "*"); });<h3>Optional</h3>
<strong>url</strong> : http://localhost/index.html#user
<strong>url</strong> : http://localhost/index.html#user/12
```javascript
hrouter("user/:id?", function (id) {
if (id) {
$('#text').html("Alejandro's id is" + id);
} else {
$('#text').html("User not found");
}
}, function (id) {
if (id) {
document.title = "Alejandro's Profile";
} else {
document.title = "Unknown Profile";
}
});