thorsteinsson/jquery-routes

Did not work on link click

Closed this issue · 1 comments

ve3 commented
var newsModule = {
        fetch: function() {
            $('#news').load('news.php?id=' + this.id).show();
        }
        fetchAll: function() {
            $('#news').load('news.php').show();
        }
    };

$.routes.add('/news/{id:int}/', newsModule.fetch);

on link click to http://localhost/app/news/11. it just open web page normal, not ajax load.

You have to point the link to #/news/11/. This library uses the hash change event.

If you want to skip the hash from the url you should use the HTML 5 history API (pushState). But then you need to make sure that the server side handles different urls correctly.